CLI

In scope of this article the task term is a piece of work that is done on stories, scenarios, steps and other entities and that produces some output based on the work done.

Example 1. The format of a task
./gradlew <task to perform>
Example 2. The format of a task with arguments
./gradlew <task to perform> --args='<arguments to pass into the task>'
The tasks are available only through the gradlew command.

Run stories

The task runs test stories based on current tests configuration and tests state on the file system.

Example 3. macOS / Linux:
./gradlew runStories
Example 4. Windows:
gradlew runStories

Known issues occurred during stories run fail the overall test execution with the corresponding exit code by default. Use the following property in order to not treat known issues as failures:

Example 5. Enable treating of known issues as positive result for current stories run
./gradlew runStories -PtreatKnownIssuesOnlyAsPassed=true

The treating of known issues as passed can be enabled globally for project by adding the following line into the build.gradle file of the tests project:

Example 6. Enable treating of known issues as positive result for stories runs at project level
runStories.treatKnownIssuesOnlyAsPassed = true

Debug stories

The task runs test stories omitting VIVIDUS initialization check based on current tests configuration and tests state on the file system.

Example 7. macOS / Linux:
./gradlew debugStories
Example 8. Windows:
gradlew debugStories

Known issues occurred during stories run fail the overall test execution with the corresponding exit code by default. Use the following property in order to not treat known issues as failures:

Example 9. Enable treating of known issues as positive result for current debug run
./gradlew debugStories -PtreatKnownIssuesOnlyAsPassed=true

The treating of known issues as passed can be enabled globally for project by adding the following line into the build.gradle file of the tests project:

Example 10. Enable treating of known issues as positive result for debug runs at project level
debugStories.treatKnownIssuesOnlyAsPassed = true

Print available steps

The task prints all the steps that are available for the configured profiles, environments and suites in the alphabetical order.

Table 1. Options
Description Short notation Full notation Default value

Path to a file to save the list of the available steps

f

file

by default steps are printed into the console

Example 11. macOS / Linux:
./gradlew printSteps --args='-f my-steps.txt'
Example 12. Windows:
gradlew printSteps --args='-f my-steps.txt'
Example 13. Output
vividus                                             Then `$value` matches `$regex`
vividus-plugin-web-app                              When I switch back to the page
vividus-plugin-web-app                              When I press $keys on keyboard
                            COMPOSITE IN STEPS FILE Then an element with the name '$elementName' exists
                            COMPOSITE IN STEPS FILE When I click on an image with the name '$imageName'

Count steps

The task counts steps in the specified tests folder and prints them in the descending order.

Table 2. Options
Description Short notation Full notation Default value

Directory to count steps

d

dir

story

Number of steps to print

t

top

<no limits by default>

Example 14. macOS / Linux:
./gradlew countSteps --args='-t 5 -d story/uat'
Example 15. Windows:
gradlew countSteps --args='-t 5 -d story/uat'
Example 16. Output
Top of the most used steps:                                                                  occurrence(s)
Then `$variable1` is $comparisonRule `$variable2`                                                      330
Given I am on a page with the URL '$pageURL'                                                           127
Then number of elements found by `$locator` is $comparisonRule `$quantity`                             110
When I initialize the $scopes variable `$variableName` with value `$variableValue`                      83
When I change context to element located `$locator`                                                     59

Count scenario

The task counts and prints stories, scenarios and scenarios containing examples found in the specified tests folder.

Table 3. Options
Description Short notation Full notation Default value

Directory to count stories and scenarios

d

dir

story

Example 17. macOS / Linux:
./gradlew countScenarios --args='-d story/uat'
Example 18. Windows:
gradlew countScenarios --args='-d story/uat'
Example 19. Output
5  | Stories
13 | Scenarios
6  | Scenarios with Examples

Validate known issues configuration

The task validates known issues format and prints the validated known issues into the console.

Example 20. macOS / Linux:
./gradlew validateKnownIssues
Example 21. Windows:
./gradlew validateKnownIssues
Example 22. Output
Known issues found:
VVD-5
VVD-6
VVD-7
VVD-8

Find known issues by assertion pattern

The task used to find known issues contained in the test project by one or more assertion patterns.

Table 4. Options
Description Short notation Full notation Default value

Required path to a file that contains new-line-separated list of assertion patterns

f

file

<no default value>

If you miss the file argument into the task it will behave as described per Validate known issues configuration
Example 23. assertion-patterns.txt
.*Doctor Who.*
Example 24. macOS / Linux:
./gradlew validateKnownIssues --args='-f ./assertion-failures.txt'
Example 25. Windows:
gradlew validateKnownIssues --args='-f assertion-failures.txt'
Example 26. Output
Known Issue | Assertion Error
VVD-6       | .*Doctor Who.*