Today, CI/CD is one of the best practices development teams use to keep their production pipelines efficient. Automating build, test, and deployment processes helps save valuable time that can be used to focus more on development and innovation rather than manual, error-prone tasks.
Using DogQ API you can execute your test suites and receive back the results as well as parameterize your tests by setting up variables.
Executing tests externally
To trigger the external execution of a Project you need to send a POST request to our API and provide the Project token.
API endpoint: "https://dogq.io/projects/external_execute"
Token can be found at the bottom of the Project Settings .
Here's an example POST request:
curl --location --request POST "https://dogq.io/projects/external_execute" --header "TOKEN: your_token"
Token triggers the execution of the whole Project, i.e. all active Modules and Scenarios will be executed. Project token can be changed. Clicking on the respective button next to the token will randomly generate a new one.
All such test executions will be available on the Executions page and have an External api call status in the "Created by" column.
Receiving back the execution results
The payload this webhook carries is an object with test results using which you can further automate your pipeline, e.g., if there are no failed test runs -> deploy to production.
The key-value pairs are:
project_id : the ID of your project
project_name : your project name
status : "passed" (if all tests passed successfully) or "failed" (if at least one test failed)
full_test_run_count : the overall number tests executed
test_runs_passed_count : the number of tests that passed successfully
test_runs_failed_count : the number of tests that have failed during the execution
test_runs_url : a URL to Executions page with the results
The Webhook Link feature, like other notifications, only works for scheduled and externally executed runs. Once you've provided the link DogQ will attempt to send a webhook every time the Project is executed via schedule or externally. If you would like DogQ to stop, remove the link from the settings.
Setting variables via API endpoint
If a test you're running via API call has variables in it, you can change the test behavior by setting the variables in the body of your POST request.
variables[name]=value
Ensure that the variables you define in your API request match the names used in your test scripts and use "variables" as it's a mandatory key word.
In the following example we're defining a variable with the name "var_url" and giving it a value of "staging-url.io":
curl --location --request POST "https://dogq.io/projects/external_execute"
--header "TOKEN: your_token"
--data-urlencode "variables[var_url]=staging-url.io"
You can go even further than that and batch execute your Project with multiple datasets by adding {contexts} object to the body of your API request. Each test in the Project you're executing this way will be run as many times as there are datasets in the request payload.
Here's the same example from before, but using {contexts} and with several datasets.
Be careful when using {contexts} with large projects, as the total amount of test runs may quickly skyrocket even with a moderate number of datasets (total = tests * datasets).
Also in the Project Settings inside Notifications there's a field for a Webhook Link. Here you can specify a URL of an open endpoint for DogQ to send POST requests to.
The buttons next to the token are for copying and shuffling the token value.