Testing services using adapter calls and relying on data coming from a backend, it may happen, that this backend is not available for testing or does not deliver reliable test data. In this case, you can mock backend access. In this case, the E2E xUML Runtime will not try to access the backend, but just return predefined data.

You can

  • load mock data from a previous test case run
  • add mock data manually

Backends can be mocked only, if you have imported the service from repository.

Loading Mock Data from Previous Test Case Run

To load mock data from a previous test case run, open the context menu of a test case that has been run successfully once (see QueryEmployees in the screenshot below) and select Load Mock Backends:

This option only is available, if you

  • imported the service from repository
  • the test case has been run with full trace enabled 

The Analyzer will show you a list of all adapter calls and test data that is available for backend mocking.

Select the appropriate adapter call and click OK.

If you run the test case again, it will be marked as "using mock backends" by a letter "M" added to the test case icon.

Adding Mock Data Manually

If there is no data available from previous test case runs, you can enter mock data manually. Open the context menu of a test case using an adapter and select Mock Backends Manually:

A list of all adapter calls of the service is displayed.

Select the appropriate adapter call that corresponds to the operation and ...

... enter test data manually. If you need more information on how to enter test data, refer to Inserting Test Data.

If you run the test case again, it will be marked as "using mock backends" by a letter "M" added to the test case icon.

Mock definitions of a test case can be accessed via the test case properties.

Finding the Backend Adapter in Question

If you have a service with many operations and adapter calls, it may be difficult to find the appropriate adapter call in the list of adapter calls. Alternatively, you can browse through the execution path of the operation in question to find the call.

On this Page:
Related Pages:

  • No labels