Run a test scenario
Once you have constructed the test scenario, you can run it to generate a test report.
Select suitable running method
Apidog provides multiple ways to run test scenarios, suitable for different testing requirements.
Local visual execution: Initiate from the local machine, suitable for quick small-scale testing. You can run the test scenario while constructing it, which is ideal for developing and running tests concurrently.
Local Apidog CLI execution:
a. Suitable for large-scale data or a large number of iterations, as it runs faster than the visual execution.
b. Suitable for offline running.CI/CD execution: Initiate the run from a CI/CD server, suitable for automated pipelines.
Self-hosting runner execution: The team can deploy their own runners on a server, allowing the use of more powerful server resources to run the test scenarios, or to run the tests on a scheduled basis.
Let's start with the local visual execution.
Getting started
Click on "Run".
You will see a test report displaying information such as pass rate, execution time, and other data for the current run. You can expand each request to view validations and assertions.
Click on "more" to inspect the actual request and response details.
:::highlight purple
Learn more about test reports.
:::
Run options in test scenarios
When running a test scenario in Apidog, several settings and options can be configured to tailor the test execution to specific requirements.
Below, we explore the critical aspects of these settings:
Environment
Specify the service (base URL) to which requests in the scenario should be directed and the variable set to be used.
Note that custom requests have their own full URL and will NOT be directed to the environment set in this context, unlike imported steps.
Test data
The test scenario supports importing external test data sets. When the test scenario runs, the system will loop through all data sets in the data file and assign the data in the data sets to the corresponding variables, see Data-Driven Testing for details.
Iterations
Configure the number of times all steps within the scenario will be executed in a loop.
If there's a significant amount of data to process, it's recommended to use the Apidog CLI for execution instead of the Apidog client to optimize performance.
Threads
Execute all steps in multiple threads where data between threads remains isolated to prevent interference.
Note that this feature is in Beta and may require further performance optimization. For rigorous load testing, it is advised to use the Performance test functionality instead.
Threads are not supported in the CLI.
Runs on
By default, Apidog tests run on the local machine, meaning all requests originate from the local client without passing through Apidog servers.
Apidog also offers a Self-hosted runner option, which allows you to deploy the runner on other machines or servers to achieve higher performance testing or scheduled tests.
Shared
Tests in Apidog run locally by default, and the test reports are stored on the local machine, making them inaccessible to other team members.
Enable "Shared" option to share any test reports automatically with other members within the project when each test scenarios finish running.
Report-sharing records can be found in "Test Report" > "Shared". For details on test reports, please refer to Test reports.
Advanced settings
On error
Configure how the test should handle errors, which can include assertion failures, data format validation failures, server errors, etc. The options are:
- Ignore: Continue executing the next step when an error occurs (default setting).
- Continue: End the current iteration and start the next one when an error occurs.
- End execution: Stop the entire run when an error is encountered.
Delay
Set a pause between sending each step to manage and control the execution speed.
Save request/responses
By default, Apidog saves every request and response. In cases where requests or responses are significantly large (potentially several MBs), they might take up considerable disk space. You can enable this option to not save every request and response but only save assertion and validation results.
Alternatively, you can choose to save only failed requests and responses to conserve space.
Keep variable values
This option is enabled by default, ensuring that the current value of global and environment variables, when modified during the test, retains the last modified result. If this option is disabled, global and environment variables will not change after the test run; they will retain the value they had before the run.
Local variables are not affected by this setting and will be cleared after each run.
Run with stored cookies
In the lower right corner of Apidog, the
Save cookies after run
Similar to above, if you wish to update the saved cookies after executing a test scenario, enable this option.
By configuring these advanced settings in Apidog, you can fine-tune your test executions to meet your specific testing needs, ensuring efficient and precise test runs.
Run in orchestrate mode
If you are in the orchestrate mode, the relevant runtime configurations are collapsed to the right side of the "Run" button. Hover the mouse over this settings button to see the detailed runtime configurations for this test scenario.
Implementing various tests
The mentioned steps represent the basic execution of a test scenario. When setting up test scenarios, you can incorporate various advanced settings to fulfill diverse testing requirements.
- Data-driven testing: Conduct tests using diverse data sets to validate system behavior across various scenarios.
- Performance testing: Evaluate system performance under varying load conditions to assess scalability and responsiveness.
- Scheduled tasks: Establish structured plans detailing scope, approach, and timing of testing activities.
- CI/CD integration: Automate build, test, and deployment processes to ensure reliable and frequent software releases.