Command line argumentsΒΆ
@cmd_args @no_args
Feature: Calling exec-helper without command-line options
Scenarios for calling exec-helper without command-line options
Background:
Given a controlled environment
@successful
Scenario: The application is called with no command line arguments and no valid configuration file
When we call the application
Then the call should fail with return code 1
And stderr should contain 'Could not find an exec-helper settings file'
@successful
Scenario: The application is called with no command line arguments and a valid configuration file
Given a valid configuration
When we call the application
Then the call should fail with return code 1
And stderr should contain 'must define at least one command'
@cmd_args @invalid_args
Feature: Call the application with invalid arguments
Scenarios for when the application is called with invalid command-line arguments
Examples:
| command_line |
| -b |
| --blaat |
| -b blaat |
| --blaat blaat |
| --blaat blaat --foo bar |
Background:
Given a controlled environment
@error
Scenario: The version option is defined on a valid command line
Given a valid configuration
When we add the <command_line> as command line arguments
And we call the application
Then the call should fail with return code 1
And stderr should contain 'unrecognised option'
And stdout should contain 'Usage'
And stdout should contain '--help'
@error
Scenario: The version option is defined on a valid command line with no configuration file
When we add the <command_line> as command line arguments
And we call the application
Then the call should fail with return code 1
And stderr should contain 'Could not find an exec-helper settings file'
And stderr should not contain 'unrecognised option'
And stdout should contain 'Usage'
And stdout should contain '--help'
@cmd_args @help_option
Feature: Use the help command-line option
Scenarios for when the help option is given on the command line
Examples:
| command_line |
| -h |
| --help |
| --help --version --debug debug |
| --debug debug --help --version |
| --version --debug debug --help |
Background:
Given a controlled environment
@successful
Scenario: The help option is defined on a valid command line
Given a valid configuration
When we add the <command_line> as command line arguments
And we call the application
Then the call should succeed
And stdout should contain 'Usage'
And stdout should contain 'Optional arguments:'
And stdout should not contain 'Configured commands:'
@successful
Scenario: The help option is defined on a valid command line with no configuration file
When we add the <command_line> as command line arguments
And we call the application
Then the call should succeed
And stdout should contain 'Usage: exec-helper [Optional arguments] COMMANDS...'
And stdout should contain 'Optional arguments:'
And stdout should not contain 'Configured commands:'
@successful
Scenario: The help option is defined for a configuration with a command
Given a valid configuration
And the <command> command
When we add the <command_line> as command line arguments
And we call the application
Then the call should succeed
And stdout should contain 'Usage: exec-helper [Optional arguments] COMMANDS...'
And stdout should contain 'Optional arguments:'
And stdout should contain 'Configured commands:'
And stdout should contain <command>
Examples:
| command |
| Command1 |
@successful
Scenario: The help option is defined for a configuration with a pattern
Given a valid configuration
And the <pattern> pattern
When we add the <command_line> as command line arguments
And we call the application
Then the call should succeed
And stdout should contain 'Usage: exec-helper [Optional arguments] COMMANDS...'
And stdout should contain 'Optional arguments:'
And stdout should not contain 'Configured commands:'
And stdout should contain 'Values for pattern'
Examples:
| pattern |
| { "key": "PATTERN", "long_options": ["blaat"], "default_values": ["blaat"] } |
@successful
Scenario: The help option is defined for a configuration with a pattern and a command
Given a valid configuration
And the <command> command
And the <pattern> pattern
When we add the <command_line> as command line arguments
And we call the application
Then the call should succeed
And stdout should contain 'Usage: exec-helper [Optional arguments] COMMANDS...'
And stdout should contain 'Optional arguments:'
And stdout should contain 'Configured commands:'
And stdout should contain 'Values for pattern'
And stdout should contain <command>
Examples:
| command | pattern |
| Command1 | { "key": "PATTERN", "long_options": ["blaat"], "default_values": ["blaat"] } |
@cmd_args @version_option
Feature: Use the version command-line option
Scenarios for when the version option is given on the command line
Examples:
| command_line |
| --version |
| --version --debug debug --dry-run |
| --debug debug --version --dry-run |
| --dry-run --debug debug --version |
Background:
Given a controlled environment
@successful
Scenario: The version option is defined on a valid command line
Given a valid configuration
When we add the <command_line> as command line arguments
And we call the application
Then the call should succeed
And stdout should contain 'exec-helper'
And stdout should contain 'COPYRIGHT'
@successful
Scenario: The version option is defined on a valid command line with no configuration file
When we add the <command_line> as command line arguments
And we call the application
Then the call should succeed
And stdout should contain 'exec-helper'
And stdout should contain 'COPYRIGHT'
@cmd_args @dry_run_option
Feature: Use the dry run command-line option
Scenarios for when the dry run option is given on the command line
Examples:
| command_line |
| -n |
| --dry-run |
| --dry-run --debug debug --verbose |
| --debug debug --dry-run --verbose |
| --verbose --debug debug --dry-run |
Background:
Given a controlled environment
@successful
Scenario: The keep-going option is defined on a valid command line
Given a valid configuration
When we add the <command> command
And we add the <command_line> as command line arguments
And we add the <command> to the command line options
When we call the application
Then the call should succeed
And the <command> command should be called 0 times
Examples:
| command |
| describe |
@cmd_args @keep_going_option
Feature: Use the keep-going command-line option
Scenarios for when the keep-going option is given on the command line
Examples:
| command_line |
| -k |
| --keep-going |
| --keep-going --debug debug --verbose |
| --debug debug --keep-going --verbose |
| --verbose --debug debug --keep-going |
Background:
Given a controlled environment
@successful
Scenario: The keep-going option is defined on a valid command line
Given a valid configuration
When we add the <command> that returns <return_code>
And we add the <command_line> as command line arguments
And we add the <command> <nb_of_times> to the command line options
When we call the application
Then the call should fail with return code <return_code>
And the <command> command should be called <nb_of_times> times
Examples:
| command | return_code | nb_of_times |
| fail | 0 | 1 |
| fail | 0 | 3 |
| fail | 1 | 1 |
| fail | 1 | 4 |
@cmd_args @list_plugins_option
Feature: Use the 'list plugins' command-line option
Scenarios for when the 'list plugins' option is given on the command line
Examples:
| command_line |
| --list-plugins |
| --list-plugins --debug debug --dry-run |
| --dry-run --list-plugins --debug debug |
| --debug debug --dry-run --list-plugins |
Background:
Given a controlled environment
@successful
Scenario: The 'list plugins' option is defined on a valid command line
Given a valid configuration
When we add the <command_line> as command line arguments
And we call the application
Then the call should succeed
And stdout should contain 'command-line-command'
@successful
Scenario: The 'list plugins' option is defined on a valid command line with no configuration file
When we add the <command_line> as command line arguments
And we call the application
Then the call should succeed
And stdout should contain 'command-line-command'