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:
- At the command prompt, navigate to the directory where the cycle-cli.exe file is located (typically C:\Program Files (x86)\TryonSolutions\Cycle).
- Run Cycle-CLI followed by any optional parameters, with the last parameter being the name of the Feature File, Playlist, or Group Test to be executed.
- Or supply the whole path in the command line from the default prompt (C:\Program Files (x86)\TryonSolutions\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)\TryonSolutions\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)\TryonSolutions\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)\TryonSolutions\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] |
--token [arg] |
Personal authentication token obtained from the Cycle User Portal |
|
--help |
Show help message |
cycle-cli --help |
--version |
Show Cycle version |
cycle-cli --version |
Note: If your account is going to be used to schedule a job using Cycle-CLI, a Personal Access Token(PAC) is required. A PAC can be obtained under the account page in the User Portal. You can view your Personal Access Token by clicking the Generate' button.
Example running a playlist, specifying the output directory,
and specifying the project directory.
"C:\Program Files (x86)\TryonSolutions\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)\TryonSolutions\Cycle>cycle-cli –help
Help Output:
Cycle 2.2.0 (c) 2019 Tryon Solutions
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.
Comments
0 comments
Article is closed for comments.