Mock Service Follow
Each service may have a stored response, to be returned as mock response instead of executing the actual service against the backend.
This may save development time while building AppVisualizer apps, or other apps - as service execution time is reduced to practically zero and there is no dependency on the availability of the client system.
Setting Mock Response
To store response as mock, execute the service in ServiceTester, and click on the "Save as Mock" button to store the displayed response as the mock response.
Alternatively, you may set/edit the mock response in the ServiceEditor (Services tab > Click on a service > Edit > Expand the "Mock Response" section).
Executing service as mock
Pass the special "mock=true" parameter in the query parameters for a service call. For example:
The service won't be executed, and the stored mock will be returned.
If no mock response is set, the service will return mock undefined as response.
AppVisualizer with mocks
You may configure AppVisualizer application to automatically record mock data for all its invoked services by adding "recordMock=true" as URL parameter
The parameter should be added only once, after that the application will work in record mock mode until next re-login.
In record mock mode the application saves for each service invocation the resulted response as mock data to the corresponding service.
Once you have recorded mock data to the application services using the recordMock option or by using Save as Mock option for specific service, you may run the application in "mock" mode.
Please note that in mock mode the application will use mock data for any service that has it. Services with no mock data will execute as usual.
Please sign in to leave a comment.