Recording Mock Accounts
In Recording SOAP/XML Traffic and Recording HTTP/REST Traffic, MockMotor records one new mock for each combination of parameters in the incoming requests. That can generate a considerable number of mocks if the test scenarios involve too many accounts.
There is an alternative approach that keeps the number of created mocks low.
Instead of recording one mock response per request parameters, MockMotor can record one mock account instead.
One generated mock response handles any number of generated mock accounts.
When the forwarded mock is configured to create a new account, it does so. It also configures the newly created mock response to select that account.
If a mock request with all the same matching parameters already exists, MockMotor doesn’t create a new mock response. Effectively then, it only creates a new mock account.
Configuring Forwarding Mock
The forwarding mock need to create a new account for each unique parameters combination:
Account Selection in the forwarding mock to
2 Add account properties to match and their values from the request (e.g.
The created account can also be updated with the real backend response data:
Configuration of the Created Mock Response
The created mock response, in addition to all matching parameters (HTTP method, operation, match script)
described in Recording SOAP/XML Traffic and Recording HTTP/REST Traffic,
Account Selection section configured.
It matches the configuration of the forwarding mock response, but because it expects that the account already exists, it fails if the account is not found:
The response payload is updated compared to what was received from the real backend, to read the values from the account.
The locations in the response, if provided, are taken from the
Update Mock Accounts section. If you want to have more values scripted
in the response, you may consider expanding that section to contain more account properties and values.