Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space ENGINES1031 and version 10.3.3

...

  1. Choose Parasoft> Preferences> Unit Test Assistant> Mocking to configure mocking options.

      
  2. Select the Enabled check box to enable mocking objects during test creation and execution.
  3. Enable or disable the Use helper methods for mocks option. If enabled, generated tests classes will separate regular test methods from helper methods that prepare objects but do not make assertions. 
  4. Specify the mocking framework that you use.
  5. If you select PowerMock, specify a list of static methods and constructors to be mocked. Click New to add a new method or pattern. Use qualified method names and wildcards (*) to match patterns. The patterns that end with .* or  <init> will be matched with constructors. For example, the following configuration will mock:
    - all constructors in all classes whose names end with "Service",
    - all static methods and constructors in all DAO classes in all sub-packages of "com.example",
    - all methods of the InternalUtil class.



    If the specified pattern matches all methods of a class, UTA will use the mockStatic() method which mocks all static methods of a class. Otherwise, the spy() method will be used to mock individual methods that are specified. For details about the mockStatic() and spy() methods, see https://github.com/powermock/powermock/wiki/Mockito#usage

    Only the static methods and constructors specified in the table will be mocked. UTA will automatically add mocks to test templates during test creation, or display recommendations that will help you add mocks after your tests are run (see Creating Mocks).
      
  6. Click Apply.

...