Tests
A test in P4 Code Review is an HTTP URL that can be called at different stages of the review process.
You can use tests to automate triggering test runs as well as triggering other URLs when for example a review is created. The requests support URL, JSON and XML encodings and can include various arguments.
You can define multiple tests, and each review can be covered by a set of different tests. Tests are closely coupled with workflows. These workflows control which tests are run when and if they should be launched manually or automatically.
Test results sent back from the test systems are displayed in P4 Code Review.
Associate a test with a workflow to ensure that the test is run when a review associated with that workflow is started or updated. Associate a test with the global workflow to ensure that the test is run whenever a review is started or updated. This ensures that the global tests are enforced for all changes even if they are not part of a project.
- P4 Code Review tests can be created by any P4 Code Review user.
- Shared P4 Code Review tests can be viewed by any P4 Code Review user.
- Shared P4 Code Review tests can be added to a workflow by any P4 Code Review user that is authorized to edit the workflow.
- Shared P4 Code Review tests can be added to the global workflow by any P4 Code Review user that is authorized to edit the global workflow.
This section provides an introduction to listing, searching, and viewing tests.
- For instructions on how to add a test, see Add a test.
- For instructions on how to edit a test, see Edit a test.
- For instructions on how to delete a test, see Delete a test.
- For instructions on how to add a test to a workflow, see Add a workflow.
- For instructions on how to add a test to the global workflow, see Global workflow.
Listing tests
To view a list of tests, click Tests in the menu.
Logged-in users can choose which tests to display by clicking on the My Tests tab or the All Tests tab. Anonymous users only see the shared tests, the My Tests tab is not available to anonymous users:
- The My Tests: tab lists all of the tests that you are an owner of.
- The All Tests: tab lists the all of the shared tests, and tests that you are an owner of.
The Test Owner icon is displayed for tests you own.
Search test names and test descriptions
You can search for P4 Code Review test names and for the content of the test description from the tests page:
- Enter text in the search box.
- Click Search.
Any tests names and descriptions that match the search text are displayed in the tab:
Switch to the other test tab to display search results for that tab.
Viewing a test that you own
To view test details:
- Click Tests in the menu.
- Click on the name of the test you want to view.
For information about editing the test, see Add a test.
You can edit a test if you are the owner of the test, or if you have super user rights.
Viewing a shared test that you do not own
Shared tests can be viewed and used by all P4 Code Review users.
To view test details:
- Click Test in the menu.
- Click on the name of the test you want to view.
To avoid leaking sensitive information to users that do not own the test, configuration details are hidden.