Introduction

You can extend the analysis performed by UTA with the Track option that monitors an object and compares its state before and after the execution of a selected method. This gives you insight into how particular values changed during execution and helps you make relevant assertions. The Track [method_name] action displayed in the UTA interface allows you to monitor the invocation of the current tested method or a method that is selected in the editor.

Tracking Object Changes

  1. Create a new test with UTA or open an existing test and click the test method. If the test method's name is consistent with the name of the method under test, UTA will detect the tested method and display the Track [method_name] button in the UTA interface.



  2. To track an invocation of a method whose name is different than the test method name, select a specific method invocation in the editor. The UTA interface may simultaneously display two action buttons that monitor the automatically detected tested method and the method selected in the editor.



  3. Click the Track [method_name] button. UTA will run the test and display information about the values that changed during execution and may need to be asserted.
  4. View the information about object changes in the Recommendation and Variables tabs.
    The Recommendations tab displays information about recommended assertions, along with values that changed during execution. You can click the Highlight link to view individual recommendations in the execution flow.



    The Variables tab displays information about values that were used during execution. Theicon indicates values that changed.



  5. Analyze information in the UTA interface to decide which assertions you want to make.

Creating Assertions

You can make assertions from both the Recommendations and the Variables tabs.

  • In the Recommendations tab, click the Make assertions link.

  • In the Variables tab, right-click the value you want to assert and choose Make assertions.


    Alternatively, you can copy the value with the Copy option to manually complete the code.

If the detected changes are in inaccessible fields, UTA generates assertion templates that require manual modifications of code:

You can enable or disable generating recommendations for inaccessible fields; see Configuring Preferences for details.

 

 

  • No labels