Prerequisites

Node.js version >= 6.0.0

CLI Installation

Install Testim package. 

Shell

> npm install -g @testim/testim-cli

That’s it!

Basic CLI

You can find the basic CLI of your project on the settings page.
This CLI already includes the parameters of your token and project ID.
Choose the grid you want to run on from the grid list.
Copy the CLI, edit and add parameters according to your needs.
You can run a specific test, label, configuration, etc.
Use the list below to find the different parameters you can use in your CLI.

The common parameters

Here is an example of running the command with the most common options (see below detailed description for all the available options):

--project: which project
--token: so we'll know it's you
--label: what tests to run
--grid: name of the grid to run the tests on
--report-file: where to put the results (so CI server could read)

Shell

testim --label "<YOUR LABEL>" --token "<YOUR ACCESS TOKEN>" --project "<YOUR PROJECT ID>" --grid "<Your grid name>" --report-file test-results/testim-tests-report.xml

All CLI Parameters

Project:

--project Select which project-id to run tests from.

Tip! you can find the project-id in the IDE under settings


Shell

--project AOL-12323-a4b2-4762-df380

------------------------------------------------------------------------------------------------------

Access token

--token Provide your access token you got from us. If you need one please contact us: info@testim.io

Shell

--token aaaaa-1234-1234-bbbb-1234qwer1234qwer

------------------------------------------------------------------------------------------------------

Label

--label or -l Run all tests comprising one of the mentioned labels.

Note that you can also run more that one label, by adding more --label arguments

Shell

-l sanity -l custom-label2

------------------------------------------------------------------------------------------------------

Test Name

--name or -n, specify test name to run.

Note that you can also run more that one test by name, by adding more --name arguments

Shell

--name login_to_app

------------------------------------------------------------------------------------------------------

Test id

--testId or -t, specify test id to run.

Note that you can also run more that one test by id, by adding more --testId arguments

Shell

--testId 5e1c62b2-7c30-635b-6441-dd804126118b

------------------------------------------------------------------------------------------------------

Grid Name

--grid to specify the Selenium Grid name to use. You can use "Testim-Grid"/ your local selenium grid/ Saucelabs / Browserstuck

--grid <grid-name>

Note: Read here how to configure your grid.
------------------------------------------------------------------------------------------------------

Report File

 --report-file or -r specify where to print the report (by default to the output stream). The file is in the format of JUnitXMLReportner. This is used to integrate Testim results with the CI display. Usually, you'll need to set the build config in the CI to look for that file so make sure the CLI param value and the build config are set to the same location.

Shell

-r ~/report.xml

------------------------------------------------------------------------------------------------------

Base URL

--base-url Starting URL after browser opens

Shell

--base-url staging.example.com

------------------------------------------------------------------------------------------------------

Test Config

test-config Specifies a configuration name (s) (browser, operating system, resolution) that will override the configuration defined for all tests in this run.
Read more here

Shell

--test-config "1280x1024_SXGA_chrome" --test-config "1366x768_WXGA_firefox"

------------------------------------------------------------------------------------------------------

Mode selenium

When you run IE11, Edge, or Safari, you'll need to add this parameter before you can run. read more here

Shell

--mode selenium

------------------------------------------------------------------------------------------------------

Test Suite

Suite option specifies test suite name to run. You can run more than one suite. 

Shell

--suite "suite_name" --suite "suite_name2"

------------------------------------------------------------------------------------------------------

Test Plan

Test plan option specifies test plan name to run. You can run more than one plan. 

Shell

--test-plan "Test Plan Demo"

------------------------------------------------------------------------------------------------------

Test timeout 

Timeout time to abort the test run if a timeout has elapsed. The timeout should be in milliseconds. The default is set to 10 minutes. 

Shell

--timeout 120000

-------------------------------------------------------------------------------------------------------

Branches

To run on a specific branch:

--branch <branch-name>

-------------------------------------------------------------------------------------------------------

Parallel

How many tests should run in parallel

--parallel <parallel-count>

-------------------------------------------------------------------------------------------------------

Config file

--config-file or -c Specify all the configuration options from external configuration File. 
Place the config file in a path accessible by the shell, specify in the command the path to the file. 

Shell

--config-file testimConfig.js

Read more about configuration file here.
------------------------------------------------------------------------------------------------------

Dedicated Run Tunnel

Tunnels let you run your app from an internal server/localhost and view it in an external browser.

--tunnel  #default application port 80

Shell

testim --tunnel --tunnel-port <APP PORT default 80>

For more info check out: http://docs.testim.io/ci-cd-integrations/dedicated-run-tunnel

-------------------------------------------------------------------------------------------------------

Did this answer your question?