Mock Accounts

A mock account simulates a real account.

For example, a business domain can include a concept of a user that has first and last name, phone number, email, address, account number and balance. A mock account would then have the same fields (defined as properties).

Despite that in the real environment, the contact information may be stored in one backend system and the account information in another, in MockMotor all these data are merged into one mock account and can be used by any reaction within the mock environment.

Use of Accounts in Reactions

Every reaction can select one or many accounts to use based on values from the request.

For example, if the GetPostOfficeDetail request contains office-id 103157, the reaction can select an account where property officeId has value 103157 and use other properties from that account (address, coordinates) to form the response.

Hence, instead of having, for example, 100 reaction for 100 GetPostOfficeDetail requests - one per office ID - we can have only one reaction, which produces the expected result based on the account values.

Selected accounts are placed into variable $accounts (accounts for Javascript scripts) and can be iterated by XQuery and Javascript code, respectively.

We can also control the response forming based on account values, and include some sections for only some accounts but not for some others. In other words, we can practice a data-driven approach.

Use of Accounts in List Reactions

Because a reaction can gather a list of accounts, it is possible to mock group operations, such as GetSubscribers, where the response contains several accounts.

The reaction would select accounts by their parent or shared value (e.g. status of subscribers) and iterates $accounts variable to form the result.

Tens of Thousands Accounts per Environment

A mock environment can use tens of thousands of accounts.

The largest mock environment known to me at the time of writing these lines has about 76,000 accounts.

The exact number of supported accounts depends on the number of properties per account and how often those accounts are updated during the execution (an update forces MockMotor to drop some caches, potentially causing a performance impact).

Mock Accounts & Mock Environments

Each mock environment has its own set of mock accounts.

Two otherwise identical environments (i.e. having the same services and reactions) can have a different set of accounts, permitting testing of very different scenarios for data-driven applications.

Updating using Excel

The most convenient way to perform data seeding or updates of mock accounts in MockMotor is to download them into Microsoft Excel (or any spreadsheet application that supports Excel *.xlsx files).

Read more in Working with Mock Accounts in Excel.

Updating from UI

When you only need to create or update a few accounts, you can do it straight from the MockMotor UI.