Unit Test Assistant can analyze your code to generate compilable unit tests for individual methods. It generates runnable test templates that include initial values and sample assertions, which can be easily modified or uncommented.
Creating a Test
- If the Unit Test Assistant view is not already open, choose Parasoft> Show View> Unit Test Assistant from the Eclipse menu bar.
- Select a method in the editor.
- Click the Regular action link to create a test for the selected method.
- Uncomment the assertions and modify the default UTA values if necessary.
- Run the test with UTA to collect coverage information and recommendations for possible improvements (see Executing Unit Tests with Unit Test Assistant).
Cloning a Test
You can create a new test by cloning an already existing one and modifying the content of the duplicate.
- Select a test in the editor.
- Click the Clone [test name] action link to duplicate the test.
- Modify the duplicate test code.
You can clone one test multiple times. The names of the duplicates will be followed by consecutive numbers.