Usage of CLI Tools
echoapi-cli
echoapi-cli is a command-line tool designed to execute EchoAPI interface cases and test cases. It allows you to easily run and test these cases directly from the command line.
It is built for scalability, making it easy to integrate with continuous integration servers and build systems. This enables the automation of testing and execution of EchoAPI interface cases without manual intervention.
This module is currently open source.
Github: https://github.com/EchoAPI-Team/echoapi-cli
NPM: https://www.npmjs.com/package/echoapi-cli?activeTab=readme
Installation
Use the following command to install EchoAPI CLI:
npm install -g echoapi-cli
If you have an older version of echoapi-cli installed, please uninstall it first. To list installed npm packages: npm list -g --depth=0. Uninstall command: npm uninstall -g echoapi-cli.
Running
echoapi run "https://app.echoapi.com/open/ci/automated_testing?ci_id=MTkzMDI0MTEwMDU2ODQ5NDA4OjEyOTMzMDc1MDgzNjc3NzEwOjEzMDcyNjE0MDg3OTQ2Mjcy\u0026token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoxODE0NCwiaXNzIjoiYXBpcG9zdCIsImV4cCI6MTcxNzY5MDAxNX0.wNNw0MbsbobhDcAZmiXJQu6lmhWaES6E2y8YFyKkzm8" -n 5 -r cli,json
Options
Usage: echoapi run [options] <url>
Options:
-r, --reporters Specify the type of test report, supports cli, html, json (default: "cli")
-n, --iteration-count Set the number of iterations. Default value is 1
-d, --iteration-data Set the path of [public] test data for case iteration (JSON or CSV). If set, it will replace the default [public] test data.
--external-program-path Specify the file path of the [external program], default is the current execution directory of the command
--out-dir Output test report directory, default directory is: /Users/mhw/echoapi-reports
--out-file Output test report file name, no need to add suffix, default format is echoapi-reports-current YYYY-MM-DD HH:mm:ss
--ignore-redirects <0/1> Prevent EchoAPI from automatically redirecting requests that return 3XX status codes. 0 to prevent, 1 not to prevent (default: "0")
--max-request-loop Maximum number of redirects for 3XX redirects (default: 5)
--timeout-request Specify the timeout for interface requests (default: 0)
--timeout-script Specify the timeout for pre-execution/post-execution scripts (default: 5000)
--delay-request Specify the interval between requests (default: 0)
-k --insecure Disable SSL verification (1 to disable, 0 to enable. default: 1) (default: 1)
--ssl-client-cert-list Path to the client certificate configuration file (JSON). This option takes precedence over sslClientCert, sslClientKey, and sslClientPassphrase.
--ssl-client-cert Specify the client certificate path (CRT file)
--ssl-client-pfx Specify the client certificate path (PFX file)
--ssl-client-key Specify the client certificate private key path (KEY file)
--ssl-client-passphrase Specify the client certificate password (for protected key)
--ssl-extra-ca-certs Specify additional trusted CA certificates (PEM)
--web-hook Web-hook to send JSON report data to the specified URL (POST) after the task is completed
-h, --help Display help for command
Example of Client Certificate Configuration File (JSON)
{
"https://wwww.example.com:443": {
"pfx": {
"file_url": ""
},
"crt": {
"file_url": ""
},
"key": {
"file_url": ""
},
"password": ""
},
"https://*.echoapi.com:443": {
"key": {
"file_url": ""
},
"pfx": {
"file_url": ""
},
"crt": {
"file_url": ""
},
"password": ""
}
}
Upgrade Version
Use the following command to upgrade the EchoAPI CLI tool:
npm install echoapi-cli@latest -g