Command line tool
We've added the
testmace-cliconsole utility for running tests right from a TestMace project for you to improve automated processes, including API testing. Its possible use cases are:
- Quick testing without GUI after changing the API implementation;
- Running tests automatically before making a commit in the version control system;
- Running tests while automatic integration or CI/CD delivery;
- Regular scheduled testing for API operativity and stability monitoring.
To install the tool, run the following command:
npm install --global @testmace/cli
The simplest way to run the tests is shown below.
Use the following command to test a local project:
Use the following command to test a cloud project:
testmace-cli -p <project_id> -t <access_token>
If all tests are successful, the 0 code will be returned, otherwise you'll see the 1 code. By default, tests results are printed to stdout.
The tool supports the following run parameters:
--environment <project_environment_name>- allow to specify what environment variables to use while running tests. The name should correspond to one of the project's environments.
--reporter <reporter_type>- allow to specify what kind of test reports you want to see. You can use
reporter_type, which generates the result in the JUnit XML format.
--project <project_id>- a cloud project identifier . You can find it on the particular project cloud sync control panel.
--token <access_token>- an authorization token that you need to use the cloud sync feature. You can manage authorisation tokens in the user's profile on the cloud sync control panel.
If you run the program with the
--reporter=junitkey, the report will be generated in the JUnit XML format. It gives you a more detailed report of successful and failed requests and tests. Reports of this kind can be visualized by special programs (e. g. XUnit Viewer) and CI/CD systems (e.g. Jenkins).
In reports each running node in the project tree is represented as TestSuite.The name corresponds to the relative path to your project root. For the
Linknode you should specify the relative path to the link node. properties here are the keys and values of this node's variables. Every test and HTTP-request is represented asTestCase in reports.