bex / behat-choose-tests
Extension for behat to allow you to interactively choose tests to run
Requires
- php: >=5.4
- behat/behat: ^3.0.0 <3.6
This package is auto-updated.
Last update: 2024-10-08 04:21:47 UTC
README
Behat-ChooseTestsExtension allows you to interactively choose tests to run.
Installation
Install by adding to your composer.json
:
composer require --dev bex/behat-choose-tests
Configuration
Enable the extension in behat.yml
like this:
default: extensions: Bex\Behat\ChooseTestsExtension: ~
Usage
Choose Suite
Run behat with --choose-suite
option to interactively choose a suite to run:
-
it will not show the suite-chooser
- if you are running behat with
--no-interaction
option - if you already specified the suite with the
--suite
option - if you have only 1 suite
- if you are running behat with
-
it will allow you to choose
All
suite or a specific suite. Multiple choice is not allowed yet.
Example output:
foo@bar:~$ bin/behat --choose-suite Choose suite: [0] All [1] First Suite [2] Second Suite >
Choose Feature
Run behat with --choose-feature
option to interactively choose a feature to run:
-
it will not show the feature-chooser
- if you are running behat with
--no-interaction
option - if you already specified the feature with passing the
<paths>
argument (e.g.bin/behat features/my_awesome.feature
) - if you have only 1 feature
- if you are running behat with
-
it will allow you to choose
All
feature or a specific feature. Multiple choice is not allowed yet. -
it list all features or the features in the given suite if you already selected a suite with
--suite
or--choose-suite
.
Example output:
foo@bar:~$ bin/behat --choose-feature Choose feature: [0] All [1] First feature (features/first.feature) [2] Second feature (features/second.feature) [3] Third feature (features/third.feature) [4] Forth feature (features/forth.feature) >
foo@bar:~$ bin/behat --suite="firstsuite" --choose-feature Choose feature: [0] All [1] First feature (features/first.feature) [2] Second feature (features/second.feature) >
Choose Scenario
Run behat with --choose-scenario
option to interactively choose a scenario to run:
-
it will not show the scenario-chooser
- if you are running behat with
--no-interaction
option - if you already specified the scenario with passing the
<paths>
argument and specifying a line number (e.g.bin/behat features/my_awesome.feature:3
) - if you have only 1 scenario
- if you are running behat with
-
it will allow you to choose
All
scenario or a specific scenario. Multiple choice is not allowed yet. -
it list all scenarios or the scenarios in the given suite and feature if you already specified those. (Note that you can specify the suite with
--suite
or--chose-suite
and you can specify the feature by passing the<paths>
argument or using the--choose-feature
option)
Example output:
foo@bar:~$ bin/behat --suite="firstsuite" --choose-scenario Choose scenario: [0] All [1] First scenario (features/first.feature:3) [2] Second scenario (features/first.feature:8) [3] Third scenario (features/first.feature:13) [4] First scenario (features/second.feature:3) [5] Second scenario (features/second.feature:8) [6] Third scenario (features/second.feature:13) >
foo@bar:~$ bin/behat features/first.feature --choose-scenario Choose scenario: [0] All [1] First scenario (features/first.feature:3) [2] Second scenario (features/first.feature:8) [3] Third scenario (features/first.feature:13) >
Choose Tests
Run behat with --choose-tests
option to interactively choose tests to run. It will simply enable all above choosers so --choose-tests
is equivalent to --choose-suite --choose--feature --choose-scenario
.
Example output:
foo@bar:~$ bin/behat --choose-tests Choose suite: [0] All [1] firstsuite [2] secondsuite > 1 Choose feature: [0] All [1] First feature (features/first.feature) [2] Second feature (features/second.feature) > 1 Choose scenario: [0] All [1] First scenario (features/first.feature:3) [2] Second scenario (features/first.feature:8) [3] Third scenario (features/first.feature:13) > 1 Feature: First feature Scenario: First scenario # features/first.feature:3 Given I have a few things # FeatureContext::iHaveAFewThings() When I do whatever # FeatureContext::iDoWhatever() Then I should see something # FeatureContext::iShouldSeeSomething() 1 scenario (1 passed) 3 steps (3 passed) 0m0.03s (7.85Mb)