To track visual changes dynamically fetched data needs to be identical in each test. Therefore Axcept offers the option to record request payloads and service responses. The mocked data gets injected during the test and ensure consistency during test validation. To have a deterministic comparison, dynamic data needs to be consistent. Generally, Axcept can intercept XHR requests.
As result responses are matched against stored request parameters. Axcept tries to identify a mock data which includes the same HTTP method, URL and request payload. Once a data set is found, Axcept returns a response body and status code as specified without forwarding the request to the original service. This enables the result of comparison between the previous and current test.
Use the search field to filter the list of available mock data sets. The query will be evaluated against the available mock data set names.
Create new data
To create a new Mock data set click on the + icon. Enter a name and click Create to proceed.
You can change the name anytime you want. Just make sure to press Update to apply the changes. Recorded data can also be derived from a Base Mock Data set.
Besides the Name and optional Base Mock Data set it is required to define endpoints. To create a new endpoint use the buttons marked in red.
Enter the name of the new endpoint. Additionally, you need to enter the HTTP method (GET, POST, UPDATE, DELETE) and URL.
Next, you may define the request payload. Please note that the request payload needs to be a JSON object.
Add the corresponding response status code and body. Again the response body needs to be a JSON object.
Press Create when finished.
Record on preview
A more convenient way to record mock data sets can be achieved using the test editor by selecting Run and Record Mock Data in the dropdown menu of the Preview button.
If you are not familiar with tests, you can find more information here. A dialogue will open. Enter a representative name for the mock data and press Run.
Once the preview has completed, you can find the recorded mock data in the Mock Data section of the navigation header.