Can I run Cycle from the command line?

Can I run Cycle from the command line?

Problem

Running the full Cycle client is not always practical, especially when combining Cycle Tests with a Continuous Integration or Continuous Testing process.

Solution

Cycle has the ability to run from the command line using Cycle-CLI.

To execute Cycle from the command line:

  1. At the command prompt, navigate to the directory where the cycle-cli.exe file is located (typically C:\Program Files (x86)\CycleLabs\Cycle). 
  2. Run Cycle-CLI followed by any optional parameters, with the last parameter being the name of the Feature FilePlaylist, or Group Test to be executed.
    • Or supply the whole path in the command line from the default prompt (C:\Program Files (x86)\CycleLabs\Cycle\cycle-cli).

Example

cycle-cli -o C:\Cycle\Output -e ALL_TESTS –p Example.cycproj C:\Cycle\Example.feature

Example (using complete executable path):

"C:\Program Files (x86)\CycleLabs\Cycle\cycle-cli" -o C:\Cycle\Output -e ALL_TESTS –p Example .cycproj C:\Cycle\Example.feature

Note: If your Feature includes steps that prompt the user, these steps will be skipped.

 

Required parameters

Parameter

Description

Example

Feature or Playlist

Path to Feature File or Playlist

C:\path\to\feature\feature_name.feature or C:\path\to\playlist\playlist_name.cycplay

 

Optional parameters

Parameter

Description

Example

--echo-settings

Echo the current settings to the console and exit

C:\Program Files (x86)\CycleLabs\Cycle>cycle-cli --echo-settings

--error-handling [arg]

Error Handling Strategy

For Features:

FEATURE = End Feature Execution

SCENARIO = Skip to next Scenario

For Playlists:

NONE = Skip to next Scenario

SINGLE_TEST = Skip to next feature

ALL_TESTS = End Playlist Execution

For Group Tests:

NONE = Stop Failed Terminal

SINGLE_TEST = Stop Failed Group

ALL_TESTS = End Group Test Execution

C:\Program Files (x86)\CycleLabs\Cycle>cycle-cli --error-handling ALL_TESTS [files to run]

--log-level [arg]

Logging level

TRACE = Verbose On

ERROR = Verbose Off

cycle-cli --log-level TRACE [files to run]

--no-tick

Turn off time-elapsed update for steps

cycle-cli --no-tick

--output-directory [arg]

Report output directory

cycle-cli --output-directory C:\Cycle\Output [files to run]

--project-file [arg]

Project file

cycle-cli --project-file C:\Cycle\MyProject.cycproj [files to run]

--tags [arg]

Tags to be executed

cycle-cli --tags picking [files to run]

--help

Show help message

cycle-cli --help

--version

Show Cycle version

cycle-cli --version

 

Example running a playlist, specifying the output directory,
and specifying the project directory. 

"C:\Program Files (x86)\CycleLabs\Cycle\cycle-cli" -o C:\Cycle\Output -e ALL_TESTS –p Example.cycproj C:\Cycle\Example.cycplay

 

Command Line Help

At the prompt enter: 

cycle-cli –-help

Example:

C:\Program Files (x86)\CycleLabs\Cycle>cycle-cli –help

 Help Output: 


Usage: cycle-cli [OPTION]... filenames

 Run your features, playlists, or group tests from the command line!

 Options:

      --echo-settings                      Echo the current settings to the

                                           console and exit

  -e, --error-handling  <arg>              Error Handling Strategy - see user

                                           manual for valid options

  -l, --log-level  <arg>                   logging level

  -n, --no-tick                            turn off time elapsed update for

                                           steps

  -o, --output-directory  <arg>            Report output directory

  -p, --project-file  <arg>                Project file

      --Settingskey=value [key=value]...   additional settings as key value

                                           pairs

  -s, --settings-file  <arg>               Settings file location

  -t, --tags  <arg>...                     tags

  -a, --token  <arg>                       Personal authentication token obtained

 
                                           from the Cycle User Portal

  -h, --help                               Show help message

  -v, --version                            Show version of this program

 

trailing arguments:

files (not required)   the features, playlists, or group tests to be executed

 
For all other tricks, consult the documentation!

 

Project File Parameter

This can be either the Project directory or the .cycproj file.

For example, a user has a Project in c:\users\MyUser\myproj... either c:\users\MyUser\myproj or c:\users\MyUser\myproj\myproj.cycproj would be acceptable arguments to follow the --Project-fileparameter. This can be an absolute path or relative path. If this argument is not used, Cycle-CLI will look for a .cycproj file the current directory. So in command line, if the user cd's to MyUser\myproj, they would not have to use the --project-file argument.

Cycle-CLI results

When Cycle-CLI executes, the Step results are output to the command line. Steps that pass are output with a Pass and the number of ms they took to complete. Steps that failed are output with [Fail]. Cycle-CLI completes with the line 

Feature: Feature Name [Fail]/[Pass] - {number} ms.

Any of the reporting formats available to the main Cycle client can be generated if the respective settings are applied.

Replicating Settings

In many cases, Cycle-CLI is run on a different computer than Cycle itself. It is important for teams to carefully control what settings are in use when running Cycle-CLI. It is possible to replicate the needed settings by specifying a Project file for your Cycle-CLI execution. All of the pertinent execution settings will be included in the .cycproj file.


    • Related Articles

    • Can I use Cycle to run MSQL scripts?

      Problem More complex scripts can be long and hard to read or understand for less technical users. Breaking the overall flow and SOP use case of a Cycle Feature. Solution Short MOCA commands and local syntax statements can be built in-line with the “I ...
    • Getting Started with Cycle 2

      Log In to Cycle Cloud In order to get started with Cycle 2, you will need to sign up for a Cycle Cloud account, and then download Cycle 2 from Cycle Cloud. The sign up process requires you to verify your email address. Please note, the email address ...
    • Run Cycle as an Administrator

      Problem Some steps in Cycle, mainly native app interaction steps such as clicking or typing, may not reliably execute unless Cycle is being run as an administrator. Solution It is recommended that Cycle is always run as an administrator. NOTE: You ...
    • Can I run Cycle from a remote machine without actively watching it?

      Problem One of the advantages of running Cycle scripts on a dedicated machine is the ability to execute the tests without inhibiting your ability to work locally. This article describes how to allow Cycle to successfully image match on a remote ...
    • How To Access the Cycle E-Learning Platform (Cycle University)

      The Cycle User Portal was retired with the release of Cycle 2.9.2. The former Cycle E-Learning platform was retired along with the Cycle User Portal. Training materials can be found in the Cycle University segment of our Cycle Labs website. Cycle ...