Skip to main content

Using CLI to Run Continuous Integration

This article introduces you how to initialize Apidog CLI configuration of API case and run it in CI environment.

The primary objective of continuous integration is to promptly identify and address potential issues by frequently integrating code and testing the operational status following code changes. You can seamlessly integrate Apidog CLI into your continuous integration workflow, enabling you to conveniently execute test scenarios configured within Apidog.

The automated testing files for continuous integration in Apidog support data exports in formats such as Apidog CLI, Postman, Jmeter.

Install Apidog CLI

Before installing the CLI, make sure that the Node.js version number is >= v10. For detailed command-line option explanations, please view 《Apidog CLI》 Run the following command in a terminal to install the Apidog CLI.

sudo npm install -g apidog-cli

Creating New Continuous Integration

In the test scenario, click on the "Continuous Integration" tab and tap the "New" button in the upper-right corner.

Specify the runtime environment, choose whether to use test data, set the iteration count, define the required interval pause time, and other configuration options. After that, click the "Save" button.

Run Continous Integration

Run Online Data in Real Time

After the continuous integration configuration is saved, a series of executable command lines will be automatically generated on the page.

For example:

apidog run http://xxx/api/v1/api-test/ci-config/xxxx/detail?token=xxxx -r html,cli
tip

If the environment variable is referenced in the test step, the remote value preset in the variable will be used directly when exporting the file.

Run After Exporting Data

If you want to run this test scenario through the Apidog CLI in the local environment, you need to "export" the Json file in the current test scenario first, and then run the file through the Apidog CLI tool.

Replace examples/sample.Apidog-cli.json in the following command with your path to save the file, and then run it in the terminal.

Apidog run examples/sample.Apidog-cli.json -r cli,html
tip

If environment variables are referenced within test steps, the exported file will directly utilize the locally preset values within those variables.