1. Choose Parasoft> Preferences in the menu bar.
  2. Select Unit Test Assistant.



  3. Complete the Location of tests field with the pattern that UTA will use to specify the location of the particular test case.



    You can select an option from a drop-down menu or customize the pattern with the following predefined Eclipse variables:
    ${class_name} - uses the name of the tested class
    ${package_name} - uses the name of the package that includes the tested class
    ${source_folder} - uses the name of the folder that contains the source files of the project
    ${project_name} - uses the name of the project that includes the tested class

  4. Verify the unit testing framework that you use.



    Currently UTA supports the JUnit4 testing framework.

  5. Select the framework for creating parametrized unit tests.



    JUnit4Parameterized is selected by default.

  6. Select the source for obtaining argument objects.



    If the Mock option is enabled, specify the mocking framework that you use.



    Currently, UTA supports the Mockito framework.

  7. Specify the limits for collecting data during execution.



    Maximum method call depth - Specifies the maximum depth of method calls during analysis.
    Maximum number of method calls made from a single method - Specifies the maximum number of sub-method calls from a single method. 
    Maximum total number of method calls -  Specifies the maximum number of all method calls during analysis.

  8. Enable the Generate sample assertions option to automatically generate assertion templates when a test case is created. Assertions will be created as comments in code; see Creating a Basic Unit Test for details.



  9. Specify which recommendations you want UTA to display after test execution.

    Additional threads - detects side threads, which may impact the state of your test.
    Assertions for inaccessible fields - detects inaccessible fields that have been modified during execution and generates assertion templates.
    Files created - detects files that were created during the test run, but were not removed after execution. 
    Mockable invocations - detects calls to mock objects that can be modified to ensure proper test isolation.
    Number of assertions - detects when the number of assertions made during a single test execution is too high, or when no assertions have been made.
    Static fields changed - detects when static fields have been modified during test execution.
    System properties changed - detects system properties that were modified during the test run, but not restored after execution.

    See Executing Unit Tests with Unit Test Assistant for examples of recommendations displayed by UTA.


  10. Click Apply.


You can restore the default settings by clicking the Restore Defaults button.

 

  • No labels
Write a comment…