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.
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
--host -- port: where to run the tests
--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>" --host "<SELENIUM GRID HOST, e.g. 127.0.0.1>" --port 4444 --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 Hostname/IP

--host or -h to specify the Selenium Grid hostname(domain) or IP to use.

Tip! currently this mandate specifying the port as well --port 4444 or -p 4444


Shell

#local grid -h 127.0.0.1 -p 4444


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

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 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
-------------------------------------------------------------------------------------------------------

Sauce Labs Key & Grid

--sauce-key

Shell

--sauce-key 12323-a4b2-4762-df380

Set the user

--sauce-user

Shell

--sauce-user dave

Set the grid URL and port

-h ondemand.saucelabs.com -p 80

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

BrowserStack Key

--browserstack-key

Shell

--browserstack-key sadfsdflkjdsf-sdf-fds

------------------------------------------------------------------------------------------------------
BrowserStack User

Shell

--browserstack-user sadfsdflkjdsf-sdf-fds

------------------------------------------------------------------------------------------------------
BrowserStack Options

Shell

--browserstack-options browser-stack.json

BrowserStack Options Config File Example

browser-stack.json

{
   "browserName" : "chrome",
   "browser_version" : "53.0",
   "os" : "Windows",
   "os_version" : "7"
}

Stabilization Delay: --stabilization-delay Extra delay after browser opens before injection

Did this answer your question?