After recording a new HAR and/or uploading a custom HAR and/or a Mapping File, the mock network mode for the test will be automatically enabled.
You can run the test in Mock Network mode locally using the UI or remotely through the CLI.
To run your test locally:
- In the Testim Visual Editor, go to the Test List screen and click a test for which you have recorded a new HAR or uploaded a custom HAR.
- In the Test Editor screen, a Mock Network icon will be displayed next to the Play button, indicating that the Mock network is available.
- Click the Play button to run the test using the mock network.
If a test is in a mock mode in the editor, its default run mode will be mock also through the CLI, no further flag needed
If you already uploaded a mapping file through the editor, this file will also be used in the CLI run. It is also possible to override the mapping file for the entire run by providing the path to the created mapping file. This option is only supported for remote runs.
> testim --override-map-file </path/to/mapping/file.json>
In that case, the hierarchy to mock a request will be
- CLI mapping file
- Test mapping file
- HAR file
- Perform actual call
testim <your CLI options> <your CLI parameters> --override-map-file <documents/mappingFile.json>
Updated about 2 years ago