Sharing Project Test Parameters
You can have multiple members of your team run identical tests or subsets of a test by sharing test parameters. Parameters can be shared by anyone running Jtest, whether they are on the same machine or a different machine. For example, if you create a project and add some test cases to some of your classes, any other team member who shares your project parameters can edit any of your project's classes, then run the exact same tests that you ran.
The following steps explain how to share project test parameters; they are best understood when you are looking at the example project contained in dv_mcjt.zip:
- In the Project Testing UI, create a .ptp file (e.g., all.ptp) in source control that contains the project test parameters.
- In the Project Testing UI's Search In field, enter the location of the classes that you want to test. For example, enter
-
$HOME/dv/mcjt .
- Use the Project Test Parameters' Common Parameters> Directories> Class Test Parameters Root node to specify a class test parameters root that falls under source control.
- For example, to tell Jtest to put each .ctp file in the same place as the associated .java file, open the Project Test Parameters window, go to Common Parameters> Directories, then enter
-
$HOME/dv/mcjt
- in the Class Test Parameters Root node.
- Specify any other Project Test parameters that may be needed (e.g., parameters in Common Parameters> java/javac-like Parameters, or in Common Parameters> Source Path).
- Use File> Save As to save the project test parameters in a location under source control. For example, save the project as all.ptp in the $HOME/dv/mcjt directory
- Create specific .ptp files to test subprojects within the full project.
- Each developer in the group should open the .ptp file for the full project, modify the Filter in field's parameter so that Jtest only tests the classes he or she is responsible for, then save the modified project as a different .ptp file.
- For example, to break frog.ptp into frog_yellow.ptp and frog_green.ptp:
- Copy frog.ptp to frog_yellow.ptp.
- Modify the value in the Filter In field to animals.amphibians.frog.yellow
- Copy frog.ptp to frog_green.ptp.
- Modify the value in the Filter In field to animals.amphibians.frog.green.
- Each developer should work with the .ptp and .ctp files for the classes he or she is responsible for.
- Note that the first time Jtest creates each class, it automatically creates a .ctp file for it. This .ctp file will be located in the same location as the corresponding .java file. For example, if you have a class at
-
animals/mammals/human/Human.java
- Jtest will create a .ctp file at
-
animals/mammals/human/Human.ctp
- The .ctp files in the project that you want to share should also be placed under source control. The person responsible for a given .java file should be responsible for the corresponding .ctp file.
- You only need to modify the .ctp file when you change some of the class test parameters (e.g. if you add test cases, change outcome values, or suppress static analysis error messages). In those cases, you need to check the .ctp file in and out of source control.
- To run all tests after the build, open the .ptp file associated with the full project test, then run the test by clicking the Start button. Jtest will then test all of the classes in the project using the .ctp files that all developers collaborated on.
|