Jtest's change-based testing capabilities help you optimize your testing efforts by automatically detecting test cases affected by locally modified code. This allows you to identify and re-run only the tests that are affected by your changes – saving the time and effort of executing a large number of unaffected tests for fear they might be broken.
Change-based testing is available for projects that are stored in a version control system integrated with your IDE.
Currently, change-based testing is supported for JUnit 4 tests.
Before running tests, you need to ensure that coverage data related to the source code you modify is available in the Coverage View in your IDE. To achieve this, you need to integrate Jtest into your unit test execution to collect the coverage data in an XML file or report it to DTP, and then import the data to your IDE. Collecting coverage data for each run of your unit test suite and importing the data for the most recent test run allows you to ensure that the information in your IDE is up-to-date.
The coverage.xml
file is generated when you run unit tests with your build tool (Maven, Ant, or Gradle) integrated with Jtest on your CI server. You can import the coverage data from the file if all your unit tests are executed in a single test run.
Configure your unit test execution job to collect coverage data with Maven, Gradle, or Ant. When the job runs, coverage for executed tests will be saved in a coverage.xml
file in the job location on the server. Configure your job to save the file in a location from which it can be easily downloaded.
You can import coverage data from DTP if there are multiple test runs you want to collect coverage for.
While analyzing resources, Jtest creates two .java classes in the default package of your project that are used for storing information about affected tests and running the selected test methods. Do not commit these files to your source control system.