PK m%CVZv v phpunit.xml.distnu W+A
./tests/Behat/./src/Behat/
PK m%CV_C C LICENSEnu W+A Copyright (c) 2011-2014 Konstantin Kudryashov
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
PK m%CVa CONTRIBUTING.mdnu W+A Contributing
------------
Behat is an open source, community-driven project. If you'd like to contribute,
feel free to do this, but remember to follow this few simple rules:
- Make your feature addition or bug fix,
- __Always__ as base for your changes use `master` branch (all new development
happens here),
- Add `*.features` for those changes (please look into `features/` folder for
some examples). This is important so we don't break it in a future version
unintentionally,
- Commit your code, but do not mess with `BehatApplication` version, or
`CHANGES.md` one,
- __Remember__: when you create Pull Request, always select `master` branch as
target, otherwise it will be closed (this is selected by default).
Backwards compatibility
-----------------------
Starting from `v3.0.0`, Behat is following [Semantic Versioning v2.0.0](http://semver.org/spec/v2.0.0.html).
This means that we take backwards compatibility of public API very seriously. So unless you want your PR to start a
new major version of Behat (`v4.0.0` for example), you need to make sure that either you do not change existing
interfaces and their usage across the system or that you at least introduce backwards compatibility layer together with
your change. Not following these rules will cause a rejection of your PR. Exception could be an extremely rare case
where BC break is introduced as a measure to fix a serious issue.
You can read detailed guidance on what BC means in [Symfony2 BC guide](http://symfony.com/doc/current/contributing/code/bc.html).
Contributing to Formatter Translations
--------------------------------------
Almost any output message (except exceptions and custom output) printed by Behat
formatters could be translated into your language with `--lang` option. In order
to fix/add translation, edit the appropriate section of the `i18n.php` file.
Running tests
-------------
Make sure that you don't break anything with your changes by running the test
suite with your locale set to english:
```bash
$> LANG=C bin/behat
```
PK m%CVk' .travis.ymlnu W+A language: php
php: [5.3, 5.4, 5.5, 5.6, 7.0, hhvm]
sudo: false
cache:
directories:
- $HOME/.composer/cache
branches:
except:
- /^bugfix\/.*$/
- /^feature\/.*$/
- /^optimization\/.*$/
matrix:
include:
- php: 5.3.3
env: DEPENDENCIES='low'
- php: 5.6
env: SYMFONY_VERSION='2.3.*'
- php: 5.6
env: SYMFONY_VERSION='2.7.*'
- php: 5.6
env: SYMFONY_VERSION='2.8.*'
- php: 7.0
env: SYMFONY_VERSION='3.0.*'
- php: 7.0
env: DEPENDENCIES='dev'
before_script:
- if [ "$DEPENDENCIES" = "dev" ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi;
- composer selfupdate
- if [ "$SYMFONY_VERSION" != "" ]; then composer require --no-update "symfony/symfony:${SYMFONY_VERSION}"; fi;
- if [ "$DEPENDENCIES" != "low" ]; then composer update; fi;
- if [ "$DEPENDENCIES" = "low" ]; then composer update --prefer-lowest; fi;
- export PATH=./bin:$PATH
- echo " php_version_tags.php
script:
- phpunit
- behat -fprogress --strict --tags '~@php-version,'`php php_version_tags.php`
PK m%CV5,O1A 1A i18n.phpnu W+A array(
'snippet_proposal_title' => '%1% has missing steps. Define them with these snippets:',
'snippet_missing_title' => 'Snippets for the following steps in the %1% suite were not generated (does your context implement SnippetAcceptingContext interface?):',
'skipped_scenarios_title' => 'Skipped scenarios:',
'failed_scenarios_title' => 'Failed scenarios:',
'failed_hooks_title' => 'Failed hooks:',
'failed_steps_title' => 'Failed steps:',
'pending_steps_title' => 'Pending steps:',
'scenarios_count' => '{0} No scenarios|{1} 1 scenario|]1,Inf] %1% scenarios',
'steps_count' => '{0} No steps|{1} 1 step|]1,Inf] %1% steps',
'passed_count' => '[1,Inf] %1% passed',
'failed_count' => '[1,Inf] %1% failed',
'pending_count' => '[1,Inf] %1% pending',
'undefined_count' => '[1,Inf] %1% undefined',
'skipped_count' => '[1,Inf] %1% skipped',
),
'cs' => array(
'snippet_proposal_title' => '%1% obsahuje chybné kroky. Definujte je za použití následujícího kódu:',
'snippet_missing_title' => 'Snippety pro následující kroky v sadě %1% nebyly vygenerovány (zkontrolujte správnost konfigurace):',
'failed_scenarios_title' => 'Chybné scénáře:',
'failed_hooks_title' => 'Chybné hooky:',
'failed_steps_title' => 'Chybné kroky:',
'pending_steps_title' => 'Čekající kroky:',
'scenarios_count' => '{0} Žádný scénář|{1} 1 scénář|{2,3,4} %1% scénáře|]4,Inf] %1% scénářů',
'steps_count' => '{0} Žádné kroky|{1} 1 krok|{2,3,4} %1% kroky|]4,Inf] %1% kroků',
'passed_count' => '{1} %1% prošel|{2,3,4} %1% prošly|]4,Inf] %1% prošlo',
'failed_count' => '{1} %1% selhal|{2,3,4} %1% selhaly|]4,Inf] %1% selhalo',
'pending_count' => '{1} %1% čeká|{2,3,4} %1% čekají|]4,Inf] %1% čeká',
'undefined_count' => '{1} %1% nedefinován|{2,3,4} %1% nedefinovány|]4,Inf] %1% nedefinováno',
'skipped_count' => '{1} %1% přeskočen|{2,3,4} %1% přeskočeny|]4,Inf] %1% přeskočeno',
),
'de' => array(
'snippet_proposal_title' => '%1% hat fehlende Schritte. Definiere diese mit den folgenden Snippets:',
'snippet_missing_title' => 'Snippets für die folgenden Schritte in der %1% Suite wurden nicht generiert (Konfiguration überprüfen):',
'failed_scenarios_title' => 'Fehlgeschlagene Szenarien:',
'failed_hooks_title' => 'Fehlgeschlagene Hooks:',
'failed_steps_title' => 'Fehlgeschlagene Schritte:',
'pending_steps_title' => 'Ausstehende Schritte:',
'scenarios_count' => '{0} Kein Szenario|{1} 1 Szenario|]1,Inf] %1% Szenarien',
'steps_count' => '{0} Kein Schritt|{1} 1 Schritt|]1,Inf] %1% Schritte',
'passed_count' => '[1,Inf] %1% bestanden',
'failed_count' => '[1,Inf] %1% fehlgeschlagen',
'pending_count' => '[1,Inf] %1% ausstehend',
'undefined_count' => '[1,Inf] %1% nicht definiert',
'skipped_count' => '[1,Inf] %1% übersprungen',
),
'es' => array(
'snippet_proposal_title' => 'A %1% le faltan pasos. Defínelos con estos pasos:',
'snippet_missing_title' => 'Las plantillas para los siguientes pasos en %1% no fueron generadas (revisa tu configuración):',
'failed_scenarios_title' => 'Escenarios fallidos:',
'failed_hooks_title' => 'Hooks fallidos:',
'failed_steps_title' => 'Pasos fallidos:',
'pending_steps_title' => 'Pasos pendientes:',
'scenarios_count' => '{0} Ningún escenario|{1} 1 escenario|]1,Inf] %1% escenarios',
'steps_count' => '{0} Ningún paso|{1} 1 paso|]1,Inf] %1% pasos',
'passed_count' => '[1,Inf] %1% pasaron',
'failed_count' => '[1,Inf] %1% fallaron',
'pending_count' => '[1,Inf] %1% pendientes',
'undefined_count' => '[1,Inf] %1% por definir',
'skipped_count' => '[1,Inf] %1% saltadas',
),
'fr' => array(
'snippet_proposal_title' => '%1% a des étapes manquantes. Définissez-les avec les modèles suivants :',
'snippet_missing_title' => 'Les modèles des étapes de la suite %1% n\'ont pas été générés (vérifiez votre configuration):',
'failed_scenarios_title' => 'Scénarios échoués:',
'failed_hooks_title' => 'Hooks échoués:',
'failed_steps_title' => 'Etapes échouées:',
'pending_steps_title' => 'Etapes en attente:',
'scenarios_count' => '{0} Pas de scénario|{1} 1 scénario|]1,Inf] %1% scénarios',
'steps_count' => '{0} Pas d\'étape|{1} 1 étape|]1,Inf] %1% étapes',
'passed_count' => '[1,Inf] %1% succès',
'failed_count' => '[1,Inf] %1% échecs',
'pending_count' => '[1,Inf] %1% en attente',
'undefined_count' => '[1,Inf] %1% indéfinis',
'skipped_count' => '[1,Inf] %1% ignorés',
),
'it' => array(
'snippet_proposal_title' => '%1% ha dei passaggi mancanti. Definiscili con questi snippet:',
'snippet_missing_title' => 'Gli snippet per i seguenti passaggi della suite %1% non sono stati generati (verifica la configurazione):',
'failed_scenarios_title' => 'Scenari falliti:',
'failed_hooks_title' => 'Hook falliti:',
'failed_steps_title' => 'Passaggi falliti:',
'pending_steps_title' => 'Passaggi in sospeso:',
'scenarios_count' => '{0} Nessuno scenario|{1} 1 scenario|]1,Inf] %1% scenari',
'steps_count' => '{0} Nessun passaggio|{1} 1 passaggio|]1,Inf] %1% passaggi',
'passed_count' => '{1} 1 superato|]1,Inf] %1% superati',
'failed_count' => '{1} 1 fallito|]1,Inf] %1% falliti',
'pending_count' => '[1,Inf] %1% in sospeso',
'undefined_count' => '{1} 1 non definito|]1,Inf] %1% non definiti',
'skipped_count' => '{1} 1 ignorato|]1,Inf] %1% ignorati',
),
'ja' => array(
'snippet_proposal_title' => '%1% のステップが見つかりません。 次のスニペットで定義できます:',
'snippet_missing_title' => '以下のステップのスニペットは%1%スイートに生成されませんでした(設定を確認してください):',
'skipped_scenarios_title' => 'スキップした シナリオ:',
'failed_scenarios_title' => '失敗した シナリオ:',
'failed_hooks_title' => '失敗した フック:',
'failed_steps_title' => '失敗した ステップ:',
'pending_steps_title' => '保留中のステップ:',
'scenarios_count' => '{0} No scenarios|{1} 1 個のシナリオ|]1,Inf] %1% 個のシナリオ',
'steps_count' => '{0} ステップがありません|{1} 1 個のステップ|]1,Inf] %1% 個のステップ',
'passed_count' => '[1,Inf] %1% 個成功',
'failed_count' => '[1,Inf] %1% 個失敗',
'pending_count' => '[1,Inf] %1% 個保留',
'undefined_count' => '[1,Inf] %1% 個未定義',
'skipped_count' => '[1,Inf] %1% 個スキップ',
),
'nl' => array(
'snippet_proposal_title' => 'Ontbrekende stappen in %1%. Definieer ze met de volgende fragmenten:',
'snippet_missing_title' => 'Fragmenten voor de volgende stappen in de %1% suite werden niet gegenereerd (controleer de configuratie):',
'failed_scenarios_title' => 'Gefaalde scenario\'s:',
'failed_hooks_title' => 'Gefaalde hooks:',
'failed_steps_title' => 'Gefaalde stappen:',
'pending_steps_title' => 'Onafgewerkte stappen:',
'scenarios_count' => '{0} Geen scenario\'s|{1} 1 scenario|]1,Inf] %1% scenario\'s',
'steps_count' => '{0} Geen stappen|{1} 1 stap|]1,Inf] %1% stappen',
'passed_count' => '[1,Inf] %1% geslaagd',
'failed_count' => '[1,Inf] %1% gefaald',
'pending_count' => '[1,Inf] %1% wachtende',
'undefined_count' => '[1,Inf] %1% niet gedefinieerd',
'skipped_count' => '[1,Inf] %1% overgeslagen',
),
'no' => array(
'snippet_proposal_title' => '%1% mangler steg. Definer dem med disse snuttene:',
'snippet_missing_title' => 'Snutter for de følgende stegene i %1%-samlingen ble ikke laget. (Sjekk konfigurasjonen din.):',
'failed_scenarios_title' => 'Feilende scenarier:',
'failed_hooks_title' => 'Feilende hooks:',
'failed_steps_title' => 'Feilende steg:',
'pending_steps_title' => 'Ikke implementerte steg:',
'scenarios_count' => '{0} Ingen scenarier|{1} 1 scenario|]1,Inf] %1% scenarier',
'steps_count' => '{0} Ingen steg|{1} 1 steg|]1,Inf] %1% steg',
'passed_count' => '[1,Inf] %1% ok',
'failed_count' => '[1,Inf] %1% feilet',
'pending_count' => '[1,Inf] %1% ikke implementert',
'undefined_count' => '[1,Inf] %1% ikke definert',
'skipped_count' => '[1,Inf] %1% hoppet over',
),
'pl' => array(
'snippet_proposal_title' => '%1% zawiera brakujące kroki. Utwórz je korzystając z tych fragmentów kodu:',
'snippet_missing_title' => 'Fragmenty kodu dla następujących kroków %1% nie zostały wygenerowane (sprawdź swoją konfigurację):',
'failed_scenarios_title' => 'Nieudane scenariusze:',
'failed_hooks_title' => 'Nieudane hooki:',
'failed_steps_title' => 'Nieudane kroki',
'pending_steps_title' => 'Oczekujące kroki',
'scenarios_count' => '{0} Brak scenariuszy|{1} 1 scenariusz|{2,3,4,22,23,24,32,33,34,42,43,44} %1% scenariusze|]4,Inf] %1% scenariuszy',
'steps_count' => '{0} Brak kroków|{1} 1 krok|{2,3,4,22,23,24,32,33,34,42,43,44} %1% kroki|]4,Inf] %1% kroków',
'passed_count' => '{1} %1% udany|{2,3,4,22,23,24,32,33,34,42,43,44} %1% udane|]4,Inf] %1% udanych',
'failed_count' => '{1} %1% nieudany|{2,3,4,22,23,24,32,33,34,42,43,44} %1% nieudane|]4,Inf] %1% nieudanych',
'pending_count' => '{1} %1% oczekujący|{2,3,4,22,23,24,32,33,34,42,43,44} %1% oczekujące|]4,Inf] %1% oczekujących',
'undefined_count' => '{1} %1% niezdefiniowany|{2,3,4,22,23,24,32,33,34,42,43,44} %1% niezdefiniowane|]4,Inf] %1% niezdefiniowanych',
'skipped_count' => '{1} %1% pominięty|{2,3,4,22,23,24,32,33,34,42,43,44} %1% pominięte|]4,Inf] %1% pominiętych',
),
'pt' => array(
'snippet_proposal_title' => '%1% contém definições em falta. Defina-as com estes exemplos:',
'snippet_missing_title' => 'Os exemplos para as seguintes definições da suite %1% não foram gerados (verifique a configuração):',
'failed_scenarios_title' => 'Cenários que falharam:',
'failed_hooks_title' => 'Hooks que falharam:',
'failed_steps_title' => 'Definições que falharam:',
'pending_steps_title' => 'Definições por definir:',
'scenarios_count' => '{0} Nenhum cenário|{1} 1 cenário|]1,Inf] %1% cenários',
'steps_count' => '{0} Nenhuma definição|{1} 1 definição|]1,Inf] %1% definições',
'passed_count' => '{1} passou|]1,Inf] %1% passaram',
'failed_count' => '{1} falhou|]1,Inf] %1% falharam',
'pending_count' => '[1,Inf] %1% por definir',
'undefined_count' => '{1} indefinido|]1,Inf] %1% indefinidos',
'skipped_count' => '{1} omitido|]1,Inf] %1% omitidos',
),
'pt-BR' => array(
'snippet_proposal_title' => '%1% possue etapas faltando. Defina elas com esse(s) trecho(s) de código:',
'snippet_missing_title' => 'Trecho de códigos para as seguintes etapas em %1% suite não foram geradas (verique sua configuração):',
'failed_scenarios_title' => 'Cenários falhados:',
'failed_hooks_title' => 'Hooks falhados:',
'failed_steps_title' => 'Etapas falhadas:',
'pending_steps_title' => 'Etapas pendentes:',
'scenarios_count' => '{0} Nenhum cenário|{1} 1 cenário|]1,Inf] %1% cenários',
'steps_count' => '{0} Nenhuma etapa|{1} 1 etapa|]1,Inf] %1% etapas',
'passed_count' => '[1,Inf] %1% passou',
'failed_count' => '[1,Inf] %1% falhou',
'pending_count' => '[1,Inf] %1% pendente',
'undefined_count' => '[1,Inf] %1% indefinido',
'skipped_count' => '[1,Inf] %1% pulado',
),
'ru' => array(
'snippet_proposal_title' => '%1%не содержит необходимых определений. Вы можете добавить их используя шаблоны:',
'snippet_missing_title' => 'Шаблоны для следующих шагов в среде %1% не были сгенерированы (проверьте ваши настройки):',
'skipped_scenarios_title' => 'Пропущенные сценарии:',
'failed_scenarios_title' => 'Проваленные сценарии:',
'failed_hooks_title' => 'Проваленные хуки:',
'failed_steps_title' => 'Проваленные шаги:',
'pending_steps_title' => 'Шаги в ожидании:',
'scenarios_count' => '{0} Нет сценариев|{1,21,31} %1% сценарий|{2,3,4,22,23,24} %1% сценария|]4,Inf] %1% сценариев',
'steps_count' => '{0} Нет шагов|{1,21,31} %1% шаг|{2,3,4,22,23,24} %1% шага|]4,Inf] %1% шагов',
'passed_count' => '{1,21,31} %1% пройден|]1,Inf] %1% пройдено',
'failed_count' => '{1,21,31} %1% провален|]1,Inf] %1% провалено',
'pending_count' => '[1,Inf] %1% в ожидании',
'undefined_count' => '{1,21,31} %1% не определен|]1,Inf] %1% не определено',
'skipped_count' => '{1,21,31} %1% пропущен|]1,Inf] %1% пропущено',
),
);
PK m%CV[0
bin/behat.batnu W+A @echo off
REM Behat
REM
REM This file is part of the Behat.
REM (c) Konstantin Kudryashov
REM
REM For the full copyright and license information, please view the LICENSE
REM file that was distributed with this source code.
REM
if "%PHPBIN%" == "" set PHPBIN=@php_bin@
if not exist "%PHPBIN%" if "%PHP_PEAR_PHP_BIN%" neq "" goto USE_PEAR_PATH
GOTO RUN
:USE_PEAR_PATH
set PHPBIN=%PHP_PEAR_PHP_BIN%
:RUN
"%PHPBIN%" "@bin_dir@\behat" %*PK m%CV'+[ [ bin/behatnu W+A #!/usr/bin/env php
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
define('BEHAT_BIN_PATH', __FILE__);
function includeIfExists($file)
{
if (file_exists($file)) {
return include $file;
}
}
if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../autoload.php'))) {
fwrite(STDERR,
'You must set up the project dependencies, run the following commands:'.PHP_EOL.
'curl -s http://getcomposer.org/installer | php'.PHP_EOL.
'php composer.phar install'.PHP_EOL
);
exit(1);
}
$factory = new \Behat\Behat\ApplicationFactory();
$factory->createApplication()->run();
PK m%CV_ box.jsonnu W+A {
"chmod": "0755",
"directories": ["src"],
"files": [
"LICENSE",
"i18n.php"
],
"finder": [
{
"name": ["*.php", "*.xsd", "LICENSE"],
"exclude": ["Tests", "tests", "sebastian", "phpunit", "phpspec", "process", "filesystem"],
"in": "vendor"
}
],
"compactors": "Herrera\\Box\\Compactor\\Php",
"main": "bin/behat",
"output": "behat.phar",
"stub": true
}
PK m%CVN~l l
CHANGES.mdnu W+A 3.1.0 / 2016-01-xx
==================
* Add support for Symfony 3 (thanks @benji07)
* Add ability to specify execution order of suite (thanks @ciaranmcnulty)
* Add translated keywords in definition printer (thanks @WouterJ)
* Add 'rowtable' transformations (thanks @PurpleBooth)
* Add 'narrative' filters (thanks @WouterJ)
* Add JUnit formatter (thanks @WouterJ and @james75)
* Add Japanese translation (thanks @SNakano)
* Add romanian translation for formatters (thanks @Chriton)
* Add table row transformations (thanks @ciaranmcnulty)
* Add support for negative numbers without surrounding quotes (thanks @ryancookdev)
* Handle case when non-existent config file is used (thanks @watermanio)
* Handle non-default `error_reporting()`
* Fix output buffering errors (thanks @tscheepers)
* Fix xdebug maximum nesting level errors (thanks @WorkingDevel)
* Fix weird edge case in GroupedSpecificationIterator
* Allow --verbose flag at CLI (thanks @pfrenssen)
* Allow hyphens in suite names (thanks @WouterJ)
* Allow suite settings with null values to exist (thanks @docteurklein)
* Improve "can not generate snippets" message
* Improve performance of Turnip parsing (thanks @Sam-Burns)
* Improve the snippet generation by auto-importing needed classes (thanks @stof)
3.0.15 / 2015-02-22
===================
* Fix broken null-transformations (Issue #669)
* Improve exception messages (thanks @dantleech)
3.0.14 / 2014-09-23
===================
* Improve generated context class
3.0.13 / 2014-08-28
===================
* Add support for typehinted parameters
* Allow any whitespace characters at the end of context class
* Fix scenario with decimal number following string in Turnip pattern
* Fix scenario with empty string in step with Turnip pattern
* Fix scenario where step has slashes in Turnip pattern
3.0.12 / 2014-07-17
===================
* Fix remaining issues with the definition arguments parsing
* Introduce `Testwork\Argument` component
3.0.11 / 2014-07-09
===================
* Fix argument resolution for functions with default values (thanks @alesblaznik)
* Fix step colouring of internationalised definitions
* Refactor `ContextFactory` and `RepositorySearchEngine` arguments resolution into the new
Testwork component - `ArgumentResolver`
3.0.10 / 2014-06-29
===================
* Fix argument resolution when named arguments used and method has defaults (thanks @WouterJ)
* Fix support for decimal numbers in turnip placeholders
3.0.9 / 2014-06-20
==================
* Fix definition translations reading bug with multi-suite configurations (thanks @WouterJ for reporting)
* Fix pretty printer bug with failing background and 2 scenarios (thanks @andytson for reporting)
* Fix memory footprint calculation (thanks @dready for reporting)
3.0.8 / 2014-06-06
==================
* Profile level Gherkin filters are now overridable by CLI filter options
* Rerun cache path is now configurable
* Fix turnip-based step definitions starting from token
* Fix token-based transformations interfering with regex-based ones
* Rerun cache dump have been optimised
3.0.7 / 2014-05-27
==================
* Properly generate keywords in snippets for non-english and `And`, `But` steps (thanks @kibao)
* Fix regex check bug with transformations that return objects (thanks @vaidasm)
* Return ability to use custom formatters by specifiying their class names
3.0.6 / 2014-05-06
==================
* Fix a small extension registration shortcut issue introduced in previous release (thanks @FrenkyNet)
3.0.5 / 2014-05-06
==================
* Fix a suite initialization bug when suite contexts have arguments
* Fix wrong handling of an empty `behat.yml`
* Explicitly fail when provided context argument is not supported by constructor
* Fix extension registration shortcut for 3rd-part plugins
3.0.4 / 2014-04-29
==================
* Make sure that `Before*Tested` is always executed before `Before*` hooks
* Introduce additional `After*Setup` and `Before*Teardown` events
* Improved the error reporting for invalid regexes in step definitions (thanks @stof)
3.0.3 / 2014-04-27
==================
* Support definition transformations without capture groups
* Override gherkin filters in custom profiles instead of merging them
* Refactored the handling of colors to set them earlier
([#513](https://github.com/Behat/Behat/pull/513) thanks to @stof)
3.0.2 / 2014-04-26
==================
* Fix warning on empty scenarios
3.0.1 / 2014-04-26
==================
* Make sure that `AfterStep` hook is running even if step is failed
([504](https://github.com/Behat/Behat/issues/504))
* Optimised the way service wrappers are registered (thanks @stof)
3.0.0 / 2014-04-20
==================
* Brand new highly extendable and clear architecture
* Support for multiple suites per profile
* Support for multiple contexts per suite
* Support for multiple feature paths per suite
* Support for filtered suites
* Support for unique context constructor parameters
* Hooks are first class citizens and thus have their own error and output buffering
* Turnip syntax in definitions
* Reworked formatters with improved error and output buffering
* Rerun does not require precache run
* New gherkin role filter
* Improved error handling with 3 levels of error reporting (-v, -vv, -vvv)
* Dropped subcontexts
* Dropped chained steps
* Dropped closured definitions
3.0.0rc3 / 2014-03-16
=======================
* Multiline step description support ([082da36b7db2525700287616babe982e485330d1](https://github.com/Behat/Behat/commit/082da36b7db2525700287616babe982e485330d1))
* Added ability to choose all 3 verbosity levels and moved stack traces to the 2nd one ([d550f72d6aa49f0f87a6ce0e50721356a5d04c45](https://github.com/Behat/Behat/commit/d550f72d6aa49f0f87a6ce0e50721356a5d04c45))
* Renamed Subject to Specification ([#447](https://github.com/Behat/Behat/pull/447))
* Refactored ContextSnippetGenerator ([#445](https://github.com/Behat/Behat/pull/445))
* Refactored context arguments handling ([#446](https://github.com/Behat/Behat/pull/446))
* Refactored testers to use composition over inheritance and added setUp/tearDown phase to them ([#457](https://github.com/Behat/Behat/pull/457))
* Refactored output formatters to be chain of event listeners
* Refactored hooks to use [scopes](https://github.com/Behat/Behat/tree/3.0/src/Behat/Behat/Hook/Scope) instead of events
* Fixed the GroupedSubjectIterator when dealing with an empty iterator ([2c1312780d610f01116ac42fb958c0c09a64c041](https://github.com/Behat/Behat/commit/2c1312780d610f01116ac42fb958c0c09a64c041))
* Forced the paths.base to use a real path all the time ([b4477d7cf3f9550874c609d4edc5a4f55390672c](https://github.com/Behat/Behat/commit/b4477d7cf3f9550874c609d4edc5a4f55390672c))
3.0.0rc2 / 2014-01-10
=======================
* Fixed progress formatter hooks support
* Reintroduced suite hooks (with an additional functionality of name filtering)
* Behat tells about steps that it couldn't generate snippets for
* Memory consumption optimizations
* Fixed contexts inheritance
* New formatter translations
* Added constructor arguments and class resolving extension points to context creation routine
* Simplified and cleaned `Context` package of the Behat
* Minor public API changes across the board (simplification)
* Optimized subject finding routine and cleaned extension points (`SubjectLocator`)
* Both `ExampleTested` and `ScenarioTested` now use same method name - `getScenario()`
* Added exception accessors to `StepTestResult`
* Renamed `ExerciseTester` to `Exercise`
* Added `HookableEvent` to Testwork, which extends `LifecycleEvent`
* Made `priority` attribute of a tag optional
* Changed all occurrences of `classname` to `class` across public API
* Renamed `GherkinSuite` to `GenericSuite` and moved it into the Testwork
* Added `initialize` call to extension lifecycle and Extension interface
* Renamed some extensions config keys to be more intuitive
3.0.0rc1 / 2014-01-01
=======================
* New layered and highly extendable architecture
* Standard output buffering of definitions and hooks
* Hooks as first class citizens
* New pretty and progress formatters
* Huge speed and memory footprint improvements
* Moved 40% of non-Behat related codebase into a shared foundation called Testwork
3.0.0beta8 / 2013-10-01
=======================
* Add `*SnippetsFriendlyInterface`(s) that are now required to generate snippets
* Add support for turnip-style definitions
* Use turnip-style definitions by default from `--init`
* Rename `SuitesLoader` to `SuitesRegistry` to clarify purpose
* Extract snippet generators into extendable component
* Extract context generators into extendable component
3.0.0beta7 / 2013-09-29
=======================
* Multivalue options are now array options (format, output, name and tags)
* Added back junit formatter (should support all junit formats from 4 to 7)
* Added back html formatter
* Small optimizations and refactorings
* Proper handling of hook failures
3.0.0beta6 / 2013-09-25
=======================
* Skip step execution and `AfterStep` hook if its `BeforeStep` hook failed
* Fix failure-initiated skips of hooks in Scenario and Example testers
* Refactor Suite routines
* Cleanup Context Pools
* Enhance `--definitions` option with suites output and regex search
* Add `toString()` methods to `DefinitionInterface` and `TransformationInterface`
* Add `SnippetlessContextInterface` to `Snippet` namespace - to prevent snippet generation for
custom contexts
3.0.0beta5 / 2013-09-15
=======================
* Switch to Gherkin 3.0 parser
* Complete rewrite of pretty formatter (much better outline handling)
* Automatically add `use` for `PendingException` to contexts during `--append-snippets`
* Lots of optimizations
3.0.0beta4 / 2013-08-17
=======================
* Cleanup suite configuration sub-system
* New ability to turn off specific suites through `behat.yml`
* Support for danish language
3.0.0beta3 / 2013-08-13
=======================
* Refactor extension sub-system. Update `ExtensionInterface`
* Avoid trying to create folders for non-fs suites
3.0.0beta2 / 2013-08-13
=======================
* Remove support for Symfony 2.0 components
3.0.0beta1 / 2013-08-13
=======================
* New suite-centric architecture
* New context pools sub-system with multi-context support
* New dynamic event-driven testing core
* Refactored console processors sub-system
* Refactored formatters management sub-system
* 8 new process extension points and 36 generic execution extension points
* Gherkin caching is enabled by default
* Rerun is enabled by default (use `--rerun` to rerun failed scenarios)
* New Gherkin Role filter
* Subcontexts removed in favor of context pools
* Chained steps extracted into [separate extension](https://github.com/Behat/ChainedStepsExtension)
* Closured step definitions removed
2.5.0 / 2013-08-11
==================
* First Behat LTS release
* Update Junit formatter to reflect latest junit format (thanks @alistairstead)
* Fix some container options
2.4.6 / 2013-06-06
==================
* New --stop-on-failure option
* Support JSON in environment variables
* Update Gherkin
* Support Symfony 2.3
* Out-of-the-box support for PHPUnit assertions pretty output
2.4.5 / 2013-01-27
==================
* Added wrapping of lines in progress formatter
* Added `--append-to` option to be able to add snippets to custom class
* Both `ScenarioEvent` and `OutlineExampleEvent` now extend same `BaseScenarioEvent` class
* Highly improved ability to create simple custom extensions
* Always hide stack traces for `PendingException`
* Ensured compatibility with all major symfony versions
* Fixed configs import directive and loading precedence
* Fixed path to vendor dir (solves problem of custom vendor dirs)
2.4.4 / 2012-09-12
==================
* Fixed `RuntimeException` namespacing error
* Added `FormatterManager::disableFormatter(s)` method
* Updated Gherkin parser and fixed couple of helper bugs
2.4.3 / 2012-07-28
==================
* Fixed broken `output_path` setting ([issue #169](https://github.com/Behat/Behat/issues/169))
* Added shellbang to phar executable ([issue #167](https://github.com/Behat/Behat/issues/167))
* Added feature title to progress exceptions ([issue #166](https://github.com/Behat/Behat/issues/166))
* Tuned failed formatter to print only failed examples in outline ([issue #154](https://github.com/Behat/Behat/issues/154))
* Small bugfixes
2.4.2 / 2012-06-26
==================
* Fixed broken autoloading with Composer installation
2.4.1 / 2012-06-26
==================
* Force custom context class usage if user changed it from `FeatureContext`
* Clarified `Context class not found` exception
* Use CWD for CLI options, basepath (config path) for everything else
* Pass `behat.extension.classes` container param to extensions during their load
* Tuned `event_subscriber` priorities
* Use `require_once` instead of `require` in closured loaders
* Fixed transformers bug with falsy transformations (that return **falsy** values)
* Fixed custom formatters definition bug
* Fixed formatter manager exception bug
* Fixed czech translation
* Fixed CS to be PSR2 compliant
2.4.0 / 2012-05-15
==================
* New extension system based on Symfony2 DIC component
* Refactored paths reading system (now relative paths are fully supported)
* Support latest Composer changes
* Removed static constraint for transformations
* Updated to latest Gherkin with immutable AST
* Fixed couple of definition snippet generator bugs
* Option for HTML formatter to provide step definition links
* Added fallback locale (in case if provided lang is unsupported yet)
* Print step snippets in HTML formatter only if they're enabled
* Escape placeholder brackets in HTML formatter
* Use different names for examples in JUnit formatter
* Major core cleanup
2.3.5 / 2012-03-30
==================
* Fixed formatter language configuration and locale guesser
2.3.4 / 2012-03-28
==================
* Added `StepEvent::getLogicalParent()`. Fixed issue #115
2.3.3 / 2012-03-09
==================
* Implemented Gherkin caching support ([--cache](https://github.com/Behat/Behat/commit/753c4f6e392a873a640543306191d92e6dc91099))
* Line ranges filtering support (`behat features/some.feature:12-19`. Thanks @headrevision)
* `behat.yml.dist` configs support out of the box
* Minor bug fixes
* Updated Gherkin
2.3.2 / 2012-01-29
==================
* Fixed bug in `ErrorException`, that caused wrong exceptions on warnings and notices
2.3.1 / 2012-01-26
==================
* Updated error handler to avoid suppressed exceptions
* Autoload bootstrap scripts in their name order
* Updated Gherkin dependency to v2.0.1
2.3.0 / 2012-01-19
==================
* Switch to the Behat\Gherkin 2.0 usage
* Migration to the single-file translation
* Support for callables inside steps chains
* Support for `*.yml` and `*.php` as definition translations
* Added opposite options to option switchers (`--[no-]colors`, `--[no-]multiline`, etc.)
* Redesigned `--story-syntax`
* Refactored Runner
* Performance improvements
* Bugfixes
2.2.7 / 2012-01-13
==================
* Added ability to search translated definitions with `--definitions`
* Fixed custom formatters use bug
2.2.6 / 2012-01-09
==================
* Fixed pretty and html formatters printing of undefined steps in outlines
2.2.5 / 2012-01-07
==================
* `BEHAT_PARAMS` env variable support (083092e)
* HTML formatter print styles optimization (@davedevelopment)
2.2.4 / 2012-01-04
==================
* Prevent method name duplication with definition snippets
2.2.3 / 2012-01-04
==================
* Fixed couple of `--append-snippets` bugs
2.2.2 / 2011-12-21
==================
* Fixed Composer deps
2.2.1 / 2011-12-21
==================
* Fixed Composer package bin
2.2.0 / 2011-12-14
==================
* Multiple formats and outputs support
* New `snippets` formatter
* New `failed` formatter
* Updated output of `-d` option
* Search abilities added to `-d` option
* New `--dry-run` option
* New `--append-snippets` option
* Rerun functionality refactored to use `failed` formatter internally
* Overall code refactoring and cleaning
* Polish translation added (Joseph Bielawski)
* Spanish translation updated (Andrés Botero)
* Locale autodetect
2.1.3 / 2011-11-04
==================
* Substep translations support
* Correctly print undefined substeps in pretty printer
* @Transform callback now gets all provided matches
* Always set proper encoding (UTF8)
2.1.2 / 2011-10-12
==================
* Fixed filtered feature hooks
* Fixed JUnit formatter time output in some locales
2.1.1 / 2011-10-09
==================
* Fixed multiline titles printing bug
* Fixed outline parameter inside step argument printing bug
2.1.0 / 2011-09-12
==================
* Totally revamped HTML formatter template
* Added transliteration support to definition snippets (for most langs)
* Written missed features and fixed some bugs
* Stabilization fixes for 3 major OS: MacOS/Ubuntu/Windows
2.0.5 / 2011-08-07
==================
* Cleaned ContextDispatcher extension points
* Cleaned context-parameters passing behavior
2.0.4 / 2011-08-02
==================
* Subcontexts aliasing and retrieving
* Multiple steps chaining
* `--snippets-paths` option to show steps alongside the snippets
* getContextParameters() method in SuiteEvent and FeatureEvent
* Updated to Symfony2 stable components
* Spanish translation
* Dutch translation
2.0.3 / 2011-07-20
==================
* Fixed JUnit formatter CDATA output
2.0.2 / 2011-07-17
==================
* Added extra checks to context instance mapper
* Fixed i18n support in definitions printer
* Refactored Gherkin tags inheritance
2.0.1 / 2011-07-12
==================
* Exception prefix added to statuses. Now you should throw `PendingException` instead of just
`Pending`
2.0.0 / 2011-07-12
==================
* Brand new Context-oriented architecture
* Refactored --definitions (--steps) to print more useful info
* Rafactored --story-syntax (--usage) to print more useful info
* Refactored Command to use separate processors
* Added --no-paths option
* Added --no-snippets option
* Added --expand option to expand outlines
* phar package
* Faster autoloader
* Steps chaining added
* Added BEHAT_ERROR_REPORTING constant to change error_repoting level
* Fixed some Gherkin bugs
* Fixed lots of bugs in Behat itself
1.1.9 / 2011-06-17
==================
* Updated to the latest Symfony components
1.1.8 / 2011-06-09
==================
* Fixed empty match printing in Pretty and HTML formatters
* Updated to latest Symfony components
1.1.7 / 2011-06-03
==================
* Fixed steps colorization bug in outline
* Additional checks in config import routine
1.1.6 / 2011-05-27
==================
* Updated Symfony vendors
* Refactored console formatters
1.1.5 / 2011-05-17
==================
* Fixed CWD path finding
* Fixed HTML formatter (thanks @glenjamin)
1.1.4 / 2011-05-03
==================
* Fixed `--out` option usage critical bug
* Added ability to specify `output_path` from config file
1.1.3 / 2011-04-28
==================
* JUnit formatter fix
* Formatters basePath fix. Now formatters uses CWD as path trimmer
* Relative paths locator bug fix
* Show table argument header in HTML formatter
1.1.2 / 2011-04-27
==================
* Fixed custom features path locator bug(issue #020)
1.1.1 / 2011-04-21
==================
* Fixed paths finding routines
* Totally refactored BehatCommand
* Added rerun functionality (`--rerun`)
* Ability to remove previously specified paths in `behat.yml`
* Bugfixes and little tweaks
1.1.0 / 2011-04-04
==================
* New configuration system with profiles and imports support
* New event system
* Environment parameters support
* Named regex arguments support
* Japanese translation for formatters
* JUnit formatter bugfixes
* HTML and Pretty formatters multiple arguments print bugfix
* Step snippets (proposals) bugfixes
* Updated vendor libraries
1.0.0 / 2011-03-08
==================
* Changed XSD
* Updated vendors
1.0.0RC6 / 2011-03-03
=====================
* Cleaned command options
* Added --init option
* Multiple paths support in behat.yml
* Application options refactoring
1.0.0RC5 / 2011-02-25
=====================
* Windows support
* Bundled features hooks optimizations
1.0.0RC4 / 2011-02-23
=====================
* Pretty formatter tag printing fix
* Custom formatter specification fix in `behat.yml`
* Symfony components updated
* Extension configuration manager (Symfony\Component\Config component)
* Cleaning of `behat.yml` configurator (thanks to Symfony\Component\Config)
* Additional formatter parameters support in `behat.yml`
1.0.0RC3 / 2011-02-18
=====================
* Event dispatcher binding optimizations
* Command API optimizations for easier overloading
* Formatter path trimming bugfix
* BehatExtension config merging support
1.0.0RC2 / 2011-02-15
=====================
* Step printing option bugfix
1.0.0RC1 / 2011-02-15
=====================
* Gherkin DSL parser is standalone project
* Own Behat namespace for both Behat & Gherkin
* Fully rewritten formatters (much cleaner & beautifull API)
* Big refactoring of whole Behat code (clean code DRYing)
* Config file is now handled by standart-driven DIC extension (cleaner `behat.yml`)
* API documentation retouched
* New `--strict` option
* New `--no-multiline` option
* Feature examples in your language with `--usage`
* Available definitions listing with `--steps`
* Definition i18n
* Command refactoring (much cleaner API & actions)
* Event system refactoring
* 42 new languages with new Gherkin DSL parser
0.3.6 / 2010-12-07
==================
* [Behat,Gherkin] Fixed French support includes (fr)
0.3.6 / 2010-12-06
==================
* [Behat] Updated Symfony2 Components to latest PR4
* [Gherkin] Added French support (fr)
* [Gherkin] Added German support (de)
* [Behat] Small bugfixes
0.3.5 / 2010-11-19
==================
* [Behat] Refactored EnvironmentBuilder to allow Environment service definition overload
0.3.4 / 2010-11-18
==================
* [Behat] Introduced environment builder
* [Gherkin,Behat] id locale support
0.3.3 / 2010-11-07
==================
* [Gherkin] Added ability to create Table & PyString nodes with hands (in your step to step calls for example)
* [Gherkin] Added getRowsHash() method to TableNode, so now you can "rotate" given tables
* [Gherkin] You now can add comments before language specification in your feature files
0.3.2 / 2010-11-06
==================
* [Gherkin] Added ability to specify extended langs (en-US)
* [Behat,Gherkin] Added pt-BR translation
0.3.1 / 2010-11-02
==================
* [Behat] JUnit formatter
* [Behat] Pretty & HTML formatter background hooks fix
* [Behat] Other small fixes
0.3.0 / 2010-11-02
==================
* [Behat] Refactored tags filter
* [Behat] Added name filter
* [Behat] Refactored hooks
* [Behat] Added tagged/named hooks
* [Behat] Customizable HTML formatter with w3c valid default markup
* [Behat] Ability to specify out path for formatters
* [Behat] Bunch of new options
* [Behat] DIC optimisations
0.2.5 / 2010-10-22
==================
* [Behat] Format manager introduced
* [Behat] Formatters refactoring
* [Behat] Optmized container parameters to support EverzetBehatBundle
* [Behat] --no-color => --no-colors
0.2.4 / 2010-10-19
==================
* [Behat] Autoguess of colors support
* [Behat] Formatter setup bugfix (properl casing)
0.2.3 / 2010-10-19
==================
* [Behat] Filters optimisations
* [Behat] Changed Core Loaders with topic-specific (`StepDefinition\Loader\PHPLoader`,
`Features\Loader\GherkinLoader`)
* [Behat] Simplified TestCommand in prepare of Symfony2 BehatBundle
* [Behat] Configuration file/path setting update (you can now create `behat.yml` inside `./config/behat.yml` & Behat
will load it
* [Behat] Updated Redundant & Ambiguous exceptions behavior
0.2.2 / 2010-10-10
==================
* [Behat] Configuration file/path setting update
0.2.1 / 2010-10-10
==================
* [PEAR] Fix path to phpbin on installation
0.2.0 / 2010-10-08
==================
* [Behat] Brand new stateless testers, based on Visitor pattern
* [Behat] Refactored event listeners & event names
* [Behat] Refactored formatters to confirm with new stateless testers (statuses now sent as event parameters)
* [Behat] Refactored ConsoleFormatter (and removed base formatter)
* [Behat] Removed custom I18n classes & refactored Translator routines in flavor of Symfony\Component\Translation
* [Behat] Added missed translation strings into XLIFF files
* [Behat] Optimised multiline arguments (Node instances are sent to definitions instead of their plain representations)
* [Behat] Support for Scenario Outline tokens replace in multiline arguments (tables & pystrings)
* [Behat] Step arguments transformations (including table transformations)
* [Behat] Colorize inline step arguments
* [Behat] Optimized exit statuses of CLI
* [Behat] Added ability to turn-off colors
* [Behat] Added ability to translate formatters output with `--i18n` option
* [Behat] Bunch of new core feature tests
* [Gherkin] Parser now uses Symfony Dependency Injection to
* [Gherkin] Refactored parser to be like AST (Nodes that supports Visitor pattern)
* [Gherkin] Comments support
* [Gherkin] Fixed PHPUnit warnings
* [Behat,Gherkin] PEAR release script to support http://pear.everzet.com release model
* [Behat,Gherkin] DIC naming refactoring
* [Behat,Gherkin] Autoloader refactoring
* [Behat,Gherkin] Removed Zend & Goutte depencies
0.1.5 / 2010-09-25
==================
* Added ability to call other steps inside step definition
* Added profiles
* Refactored container creation routine
* Single quotes support in step definitions
* Added tests for hooks, profiles, inline steps
0.1.4 / 2010-09-16
==================
* Refactored code
* Removed logic from object constructors
* Added Loader & Filter interfaces
0.1.3 / 2010-09-14
==================
* Ability to specify arrays of paths/files for loaders
* Event hooks and support for `support/hooks.php`
* Formatters listens events with smallest priority
* Don't try to load steps if `steps` folder doesn't exists
* Bugfixes/refactoring
0.1.2 / 2010-09-10
==================
* Added ability to read from `behat.yml` and `behat.xml`
* Moved tags filter to separate object
* Refactored injection controller
* Optimized event names in event dispatcher
* Other small fixes/refactorings
0.1.1 / 2010-09-09
==================
* Added `--tags` option
* Changed environment (world) routines
* Added lots of core tests (writed in Behat itself)
0.1.0 / 2010-09-08
==================
* Initial release
PK m%CVSG .scrutinizer.ymlnu W+A checks:
php:
code_rating: true
duplication: true
tools:
external_code_coverage: false
php_code_coverage: false
php_code_sniffer:
config: { standard: 'PSR1' }
php_changetracking: true
php_cpd: true
php_cs_fixer:
config: { level: 'psr1' }
php_mess_detector: true
php_pdepend: true
php_analyzer: true
sensiolabs_security_checker: true
filter:
paths: [ 'src/*' ]
PK m%CV&`g
composer.jsonnu W+A {
"name": "behat/behat",
"description": "Scenario-oriented BDD framework for PHP 5.3",
"keywords": ["BDD", "ScenarioBDD", "StoryBDD", "Examples", "Scrum", "Agile", "User story", "Symfony", "business", "development", "testing", "documentation"],
"homepage": "http://behat.org/",
"type": "library",
"license": "MIT",
"authors": [
{
"name": "Konstantin Kudryashov",
"email": "ever.zet@gmail.com",
"homepage": "http://everzet.com"
}
],
"require": {
"php": ">=5.3.3",
"ext-mbstring": "*",
"behat/gherkin": "~4.4",
"behat/transliterator": "~1.0",
"symfony/console": "~2.1|~3.0",
"symfony/config": "~2.3|~3.0",
"symfony/dependency-injection": "~2.1|~3.0",
"symfony/event-dispatcher": "~2.1|~3.0",
"symfony/translation": "~2.3|~3.0",
"symfony/yaml": "~2.1|~3.0",
"symfony/class-loader": "~2.1|~3.0"
},
"require-dev": {
"symfony/process": "~2.1|~3.0",
"phpunit/phpunit": "~4.5"
},
"suggest": {
"behat/symfony2-extension": "for integration with Symfony2 web framework",
"behat/yii-extension": "for integration with Yii web framework",
"behat/mink-extension": "for integration with Mink testing framework"
},
"autoload": {
"psr-0": {
"Behat\\Behat": "src/",
"Behat\\Testwork": "src/"
}
},
"extra": {
"branch-alias": {
"dev-master": "3.0.x-dev"
}
},
"bin": ["bin/behat"]
}
PK m%CVr) features/tag_filters.featurenu W+A Feature: Tags
In order to run only needed features
As a Behat user
I need to Behat support features & scenario/outline tags
Background:
Given a file named "features/bootstrap/FeatureContext.php" with:
"""
Examples:
| num |
| 31 |
| 32 |
@normal
Scenario:
Given Some normal step N38
@fast
Scenario Outline:
Given Some fast step N
Examples:
| num |
| 33 |
| 34 |
@normal @fast
Scenario Outline:
Given Some normal step N
And Some fast step N37
Examples:
| num |
| 35 |
| 36 |
"""
And a file named "features/feature4.feature" with:
"""
Feature: Feature N4
@normal
Scenario:
Given Some normal step N41
And Some fast step N42
@fast
Scenario:
Given Some slow step N43
"""
Scenario: Single tag
When I run "behat --no-colors -f pretty --tags '@slow' --format-settings='{\"paths\": false}'"
Then it should pass
And the output should contain:
"""
@slow
Feature: Feature N1
Background:
Given Some slow step N11
Scenario:
Given Some slow step N12
And Some normal step N13
@fast
Scenario:
Given Some fast step N14
"""
And the output should contain:
"""
Feature: Feature N2
Background:
Given Some normal step N21
@slow @fast
Scenario:
Given Some slow step N22
And Some fast step N23
"""
And the output should contain:
"""
Feature: Feature N3
Background:
Given Some normal step N21
@slow
Scenario Outline:
Given Some slow step N
Examples:
| num |
| 31 |
| 32 |
"""
And the output should contain:
"""
5 scenarios (5 passed)
12 steps (12 passed)
"""
Scenario: Or tags
When I run "behat --no-colors -f pretty --tags '@slow,@normal' --format-settings='{\"paths\": false}'"
Then it should pass
And the output should contain:
"""
@slow
Feature: Feature N1
Background:
Given Some slow step N11
Scenario:
Given Some slow step N12
And Some normal step N13
@fast
Scenario:
Given Some fast step N14
"""
And the output should contain:
"""
Feature: Feature N2
Background:
Given Some normal step N21
@slow @fast
Scenario:
Given Some slow step N22
And Some fast step N23
"""
And the output should contain:
"""
Feature: Feature N3
Background:
Given Some normal step N21
@slow
Scenario Outline:
Given Some slow step N
Examples:
| num |
| 31 |
| 32 |
@normal
Scenario:
Given Some normal step N38
@normal @fast
Scenario Outline:
Given Some normal step N
And Some fast step N37
Examples:
| num |
| 35 |
| 36 |
"""
And the output should contain:
"""
Feature: Feature N4
@normal
Scenario:
Given Some normal step N41
And Some fast step N42
"""
And the output should contain:
"""
9 scenarios (9 passed)
22 steps (22 passed)
"""
Scenario: Overriding behat.yml filters with CLI options
Given a file named "behat.yml" with:
"""
default:
gherkin:
filters:
tags: ~@slow
"""
When I run "behat --no-colors -f pretty --tags '@slow' --format-settings='{\"paths\": false}'"
Then it should pass
And the output should contain:
"""
@slow
Feature: Feature N1
Background:
Given Some slow step N11
Scenario:
Given Some slow step N12
And Some normal step N13
@fast
Scenario:
Given Some fast step N14
"""
And the output should contain:
"""
Feature: Feature N2
Background:
Given Some normal step N21
@slow @fast
Scenario:
Given Some slow step N22
And Some fast step N23
"""
And the output should contain:
"""
Feature: Feature N3
Background:
Given Some normal step N21
@slow
Scenario Outline:
Given Some slow step N
Examples:
| num |
| 31 |
| 32 |
"""
And the output should contain:
"""
5 scenarios (5 passed)
12 steps (12 passed)
"""
PK m%CV08:?1 ?1 features/context.featurenu W+A Feature: Context consistency
In order to maintain stable behavior tests
As a feature writer
I need a separate context for every scenario/outline
Background:
Given a file named "features/bootstrap/FeatureContext.php" with:
"""
parameters = array('parameter1' => $parameter1, 'parameter2' => $parameter2);
}
/**
* @Given /^I have (\d+) apples?$/
*/
public function iHaveApples($count) {
$this->apples = intval($count);
}
/**
* @When /^I ate (\d+) apples?$/
*/
public function iAteApples($count) {
$this->apples -= intval($count);
}
/**
* @When /^I found (\d+) apples?$/
*/
public function iFoundApples($count) {
$this->apples += intval($count);
}
/**
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
}
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($key, $val) {
PHPUnit_Framework_Assert::assertEquals($val, $this->parameters[$key]);
}
/**
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($key, $count) {
PHPUnit_Framework_Assert::assertInternalType('array', $this->parameters[$key]);
PHPUnit_Framework_Assert::assertEquals(2, count($this->parameters[$key]));
}
}
class FeatureContext extends CoreContext implements CustomSnippetAcceptingContext
{
public static function getAcceptedSnippetType() { return 'regex'; }
}
"""
And a file named "features/bootstrap/CustomContext.php" with:
"""
apples
And I found apples
Then I should have apples
Examples:
| ate | found | result |
| 3 | 1 | 1 |
| 0 | 5 | 8 |
| 2 | 2 | 3 |
"""
When I run "behat --no-colors -f progress features/apples.feature"
Then it should pass with:
"""
..................
5 scenarios (5 passed)
18 steps (18 passed)
"""
Scenario: False "apples story"
Given a file named "features/apples.feature" with:
"""
Feature: Apples story
In order to eat apple
As a little kid
I need to have an apple in my pocket
Background:
Given I have 3 apples
Scenario: I'm little hungry
When I ate 1 apple
Then I should have 5 apples
Scenario: Found more apples
When I found 10 apples
Then I should have 10 apples
Scenario Outline: Other situations
When I ate apples
And I found apples
Then I should have apples
Examples:
| ate | found | result |
| 3 | 1 | 3 |
| 0 | 5 | 8 |
| 2 | 2 | 4 |
"""
When I run "behat --no-colors -f progress features/apples.feature"
Then it should fail with:
"""
..F..F...F.......F
--- Failed steps:
Then I should have 5 apples # features/apples.feature:11
Failed asserting that 2 matches expected 5.
Then I should have 10 apples # features/apples.feature:15
Failed asserting that 13 matches expected 10.
Then I should have 3 apples # features/apples.feature:20
Failed asserting that 1 matches expected 3.
Then I should have 4 apples # features/apples.feature:20
Failed asserting that 3 matches expected 4.
5 scenarios (1 passed, 4 failed)
18 steps (14 passed, 4 failed)
"""
Scenario: Context parameters
Given a file named "behat.yml" with:
"""
default:
suites:
default:
contexts:
- FeatureContext:
parameter1: val_one
parameter2:
everzet: behat_admin
avalanche123: behat_admin
"""
And a file named "features/params.feature" with:
"""
Feature: Context parameters
In order to run a browser
As feature runner
I need to be able to configure behat context
Scenario: I'm little hungry
Then context parameter "parameter1" should be equal to "val_one"
And context parameter "parameter2" should be array with 2 elements
"""
When I run "behat --no-colors -f progress features/params.feature"
Then it should pass with:
"""
..
1 scenario (1 passed)
2 steps (2 passed)
"""
Scenario: Context parameters including optional
Given a file named "behat.yml" with:
"""
default:
suites:
default:
contexts:
- FeatureContext:
parameter1: val_one
"""
And a file named "features/params.feature" with:
"""
Feature: Context parameters
In order to run a browser
As feature runner
I need to be able to configure behat context
Scenario: I'm little hungry
Then context parameter "parameter1" should be equal to "val_one"
Then context parameter "parameter2" should be equal to "val2_default"
"""
When I run "behat --no-colors -f progress features/params.feature"
Then it should pass with:
"""
..
1 scenario (1 passed)
2 steps (2 passed)
"""
Scenario: Existing custom context class
Given a file named "behat.yml" with:
"""
default:
suites:
default:
contexts: [ CustomContext ]
"""
And a file named "features/params.feature" with:
"""
Feature: Context parameters
In order to run a browser
As feature runner
I need to be able to configure behat context
Scenario: I'm little hungry
Then context parameter "parameter1" should be equal to "val_one"
And context parameter "parameter2" should be array with 2 elements
"""
When I run "behat --no-colors -f progress features/params.feature"
Then it should pass with:
"""
UU
1 scenario (1 undefined)
2 steps (2 undefined)
--- CustomContext has missing steps. Define them with these snippets:
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($arg1, $arg2)
{
throw new PendingException();
}
/**
* @Then /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($arg1, $arg2)
{
throw new PendingException();
}
"""
Scenario: Single context class instead of an array provided as `contexts` option
Given a file named "behat.yml" with:
"""
default:
suites:
default:
contexts: UnexistentContext
"""
And a file named "features/params.feature" with:
"""
Feature: Context parameters
In order to run a browser
As feature runner
I need to be able to configure behat context
Scenario: I'm little hungry
Then context parameter "parameter1" should be equal to "val_one"
And context parameter "parameter2" should be array with 2 elements
"""
When I run "behat --no-colors -f progress features/params.feature"
Then it should fail with:
"""
[Behat\Testwork\Suite\Exception\SuiteConfigurationException]
`contexts` setting of the "default" suite is expected to be an array, string given.
"""
Scenario: Unexisting custom context class
Given a file named "behat.yml" with:
"""
default:
suites:
default:
contexts: [ UnexistentContext ]
"""
And a file named "features/params.feature" with:
"""
Feature: Context parameters
In order to run a browser
As feature runner
I need to be able to configure behat context
Scenario: I'm little hungry
Then context parameter "parameter1" should be equal to "val_one"
And context parameter "parameter2" should be array with 2 elements
"""
When I run "behat --no-colors -f progress features/params.feature"
Then it should fail with:
"""
[Behat\Behat\Context\Exception\ContextNotFoundException]
`UnexistentContext` context class not found and can not be used.
"""
Scenario: Unexisting context argument
Given a file named "behat.yml" with:
"""
default:
suites:
default:
contexts:
- FeatureContext:
unexistingParam: 'value'
"""
And a file named "features/params.feature" with:
"""
Feature: Context parameters
In order to run a browser
As feature runner
I need to be able to configure behat context
Scenario: I'm little hungry
Then context parameter "parameter1" should be equal to "val_one"
And context parameter "parameter2" should be array with 2 elements
"""
When I run "behat --no-colors -f progress features/params.feature"
Then it should fail with:
"""
[Behat\Testwork\Argument\Exception\UnknownParameterValueException]
`CoreContext::__construct()` does not expect argument `$unexistingParam`.
"""
Scenario: Suite without contexts and FeatureContext available
Given a file named "behat.yml" with:
"""
default:
suites:
first:
contexts: []
"""
And a file named "features/some.feature" with:
"""
Feature: Apples story
In order to eat apple
As a little kid
I need to have an apple in my pocket
Scenario: I'm little hungry
Given I have 3 apples
When I ate 1 apple
Then I should have 2 apples
"""
When I run "behat --no-colors -fpretty --format-settings='{\"paths\": true}' features"
Then it should pass with:
"""
Feature: Apples story
In order to eat apple
As a little kid
I need to have an apple in my pocket
Scenario: I'm little hungry # features/some.feature:6
Given I have 3 apples
When I ate 1 apple
Then I should have 2 apples
1 scenario (1 undefined)
3 steps (3 undefined)
--- Snippets for the following steps in the first suite were not generated (does your context implement SnippetAcceptingContext interface?):
Given I have 3 apples
When I ate 1 apple
Then I should have 2 apples
"""
PK m%CVOǵ) ) features/snippets.featurenu W+A Feature: Snippets
In order to not manually write definitions every time
As a feature tester
I need tool to generate snippets for me
Background:
Given a file named "features/coffee.feature" with:
"""
Feature: Snippets
Background:
Given I have magically created 10$
Scenario: Single quotes
When I have chose 'coffee with turkey' in coffee machine
Then I should have 'turkey with coffee sauce'
And I should get a 'super/string':
'''
Test #1
'''
And I should get a simple string:
'''
Test #2
'''
Scenario: Double quotes
When I have chose "pizza tea" in coffee machine
And do something undefined with \1
Then I should have "pizza tea"
And I should get a "super/string":
'''
Test #1
'''
And I should get a simple string:
'''
Test #2
'''
"""
Scenario: Regex snippets
Given a file named "features/bootstrap/FeatureContext.php" with:
"""
value = intval($number);
}
/**
* @Then /Я должен иметь (\d+)/
*/
public function iShouldHave($number) {
PHPUnit_Framework_Assert::assertEquals(intval($number), $this->value);
}
/**
* @When /Я добавлю (\d+)/
*/
public function iAdd($number) {
$this->value += intval($number);
}
/**
* @When /^Что-то еще не сделано$/
*/
public function somethingNotDone() {
throw new PendingException();
}
}
"""
And a file named "features/World.feature" with:
"""
# language: ru
Функционал: Постоянство мира
Чтобы поддерживать стабильными тесты
Как разработчик функционала
Я хочу чтобы Мир сбрасывался между сценариями
Предыстория:
Если Я ввел 10
Сценарий: Неопределен
То Я должен иметь 10
И Добавить "нормальное" число
То Я должен иметь 10
Сценарий: В ожидании
То Я должен иметь 10
И Что-то еще не сделано
То Я должен иметь 10
Сценарий: Провален
Если Я добавлю 4
То Я должен иметь 13
Структура сценария: Пройдено и Провалено
Допустим Я должен иметь 10
Если Я добавлю <значение>
То Я должен иметь <результат>
Примеры:
| значение | результат |
| 5 | 16 |
| 10 | 20 |
| 23 | 32 |
"""
Scenario: Pretty
When I run "behat --no-colors -f pretty --lang=ru"
Then it should fail with:
"""
Функционал: Постоянство мира
Чтобы поддерживать стабильными тесты
Как разработчик функционала
Я хочу чтобы Мир сбрасывался между сценариями
Предыстория: # features/World.feature:7
Если Я ввел 10 # FeatureContext::iHaveEntered()
Сценарий: Неопределен # features/World.feature:10
То Я должен иметь 10 # FeatureContext::iShouldHave()
И Добавить "нормальное" число
То Я должен иметь 10 # FeatureContext::iShouldHave()
Сценарий: В ожидании # features/World.feature:15
То Я должен иметь 10 # FeatureContext::iShouldHave()
И Что-то еще не сделано # FeatureContext::somethingNotDone()
TODO: write pending definition
То Я должен иметь 10 # FeatureContext::iShouldHave()
Сценарий: Провален # features/World.feature:20
Если Я добавлю 4 # FeatureContext::iAdd()
То Я должен иметь 13 # FeatureContext::iShouldHave()
Failed asserting that 14 matches expected 13.
Структура сценария: Пройдено и Провалено # features/World.feature:24
Допустим Я должен иметь 10 # FeatureContext::iShouldHave()
Если Я добавлю <значение> # FeatureContext::iAdd()
То Я должен иметь <результат> # FeatureContext::iShouldHave()
Примеры:
| значение | результат |
| 5 | 16 |
Failed asserting that 15 matches expected 16.
| 10 | 20 |
| 23 | 32 |
Failed asserting that 33 matches expected 32.
--- Проваленные сценарии:
features/World.feature:20
features/World.feature:31
features/World.feature:33
6 сценариев (1 пройден, 3 провалено, 1 не определен, 1 в ожидании)
23 шага (16 пройдено, 3 провалено, 1 не определен, 1 в ожидании, 2 пропущено)
--- FeatureContext не содержит необходимых определений. Вы можете добавить их используя шаблоны:
/**
* @Then /^Добавить "([^"]*)" число$/
*/
public function dobavitChislo($arg1)
{
throw new PendingException();
}
"""
Scenario: Progress
When I run "behat --no-colors -f progress --lang=ru"
Then it should fail with:
"""
..U-..P-..F...F.......F
--- Проваленные шаги:
То Я должен иметь 13 # features/World.feature:22
Failed asserting that 14 matches expected 13.
То Я должен иметь 16 # features/World.feature:27
Failed asserting that 15 matches expected 16.
То Я должен иметь 32 # features/World.feature:27
Failed asserting that 33 matches expected 32.
--- Шаги в ожидании:
И Что-то еще не сделано # FeatureContext::somethingNotDone()
TODO: write pending definition
6 сценариев (1 пройден, 3 провалено, 1 не определен, 1 в ожидании)
23 шага (16 пройдено, 3 провалено, 1 не определен, 1 в ожидании, 2 пропущено)
--- FeatureContext не содержит необходимых определений. Вы можете добавить их используя шаблоны:
/**
* @Then /^Добавить "([^"]*)" число$/
*/
public function dobavitChislo($arg1)
{
throw new PendingException();
}
"""
Scenario: Progress with unexisting locale
When I run "behat --no-colors -f progress --lang=xx"
Then it should fail with:
"""
..U-..P-..F...F.......F
--- Failed steps:
То Я должен иметь 13 # features/World.feature:22
Failed asserting that 14 matches expected 13.
То Я должен иметь 16 # features/World.feature:27
Failed asserting that 15 matches expected 16.
То Я должен иметь 32 # features/World.feature:27
Failed asserting that 33 matches expected 32.
--- Pending steps:
И Что-то еще не сделано # FeatureContext::somethingNotDone()
TODO: write pending definition
6 scenarios (1 passed, 3 failed, 1 undefined, 1 pending)
23 steps (16 passed, 3 failed, 1 undefined, 1 pending, 2 skipped)
--- FeatureContext has missing steps. Define them with these snippets:
/**
* @Then /^Добавить "([^"]*)" число$/
*/
public function dobavitChislo($arg1)
{
throw new PendingException();
}
"""
Scenario: Progress with unexisting locale
When I run "behat --no-colors -f progress --lang=xx"
Then it should fail with:
"""
..U-..P-..F...F.......F
--- Failed steps:
То Я должен иметь 13 # features/World.feature:22
Failed asserting that 14 matches expected 13.
То Я должен иметь 16 # features/World.feature:27
Failed asserting that 15 matches expected 16.
То Я должен иметь 32 # features/World.feature:27
Failed asserting that 33 matches expected 32.
--- Pending steps:
И Что-то еще не сделано # FeatureContext::somethingNotDone()
TODO: write pending definition
6 scenarios (1 passed, 3 failed, 1 undefined, 1 pending)
23 steps (16 passed, 3 failed, 1 undefined, 1 pending, 2 skipped)
--- FeatureContext has missing steps. Define them with these snippets:
/**
* @Then /^Добавить "([^"]*)" число$/
*/
public function dobavitChislo($arg1)
{
throw new PendingException();
}
"""
PK m%CVlm features/init.featurenu W+A Feature: Init
In order to be able to start fast
As a feature developer
I need to be able to init Behat path structure fast
Scenario: Simple init
Given I am in the "init_test" path
When I run "behat --no-colors --init"
Then it should pass with:
"""
+d features - place your *.feature files here
+d features/bootstrap - place your context classes here
+f features/bootstrap/FeatureContext.php - place your definitions, transformations and hooks here
"""
And file "features/bootstrap/FeatureContext.php" should exist
Scenario: Custom paths
Given I am in the "init_test2" path
And a file named "behat.yml" with:
"""
default:
autoload: %paths.base%/supp
suites:
default:
paths: [ %paths.base%/scenarios ]
contexts: [ CustomContext ]
"""
When I run "behat --no-colors --init"
Then it should pass with:
"""
+d scenarios - place your *.feature files here
+d supp - place your context classes here
+f supp/CustomContext.php - place your definitions, transformations and hooks here
"""
And file "supp/CustomContext.php" should exist
Scenario: Multiple suites
Given I am in the "init_test3" path
And a file named "behat.yml" with:
"""
default:
autoload: %paths.base%/contexts
suites:
suite1:
paths: [ %paths.base%/scenarios1 ]
contexts: [ Custom1Context ]
suite2:
paths: [ %paths.base%/scenarios2 ]
contexts: [ Custom2Context ]
"""
When I run "behat --no-colors --init"
Then it should pass with:
"""
+d scenarios1 - place your *.feature files here
+d contexts - place your context classes here
+f contexts/Custom1Context.php - place your definitions, transformations and hooks here
+d scenarios2 - place your *.feature files here
+f contexts/Custom2Context.php - place your definitions, transformations and hooks here
"""
And file "contexts/Custom1Context.php" should exist
And file "contexts/Custom2Context.php" should exist
Scenario: Contexts with arguments
Given I am in the "init_test2" path
And a file named "behat.yml" with:
"""
default:
autoload: %paths.base%/supp
suites:
default:
paths: [ %paths.base%/scenarios ]
contexts:
- CustomContext: [ 'a', 'b' ]
"""
When I run "behat --no-colors --init"
Then it should pass with:
"""
+d scenarios - place your *.feature files here
+d supp - place your context classes here
+f supp/CustomContext.php - place your definitions, transformations and hooks here
"""
And file "supp/CustomContext.php" should exist
PK m%CVOg features/traits.featurenu W+A @php-version @php5.4
Feature: Support php 5.4 traits
In order to have much cleaner horizontal reusability
As a context developer
I need to be able to use definition traits in my context
Background:
Given a file named "features/bootstrap/FeatureContext.php" with:
"""
apples = intval($count);
}
/**
* @When /^I ate (\d+) apples?$/
*/
public function iAteApples($count) {
$this->apples -= intval($count);
}
/**
* @When /^I found (\d+) apples?$/
*/
public function iFoundApples($count) {
$this->apples += intval($count);
}
/**
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
}
}
"""
And a file named "features/apples.feature" with:
"""
Feature: Apples story
In order to eat apple
As a little kid
I need to have an apple in my pocket
Background:
Given I have 3 apples
Scenario: I'm little hungry
When I ate 1 apple
Then I should have 2 apples
Scenario: Found more apples
When I found 5 apples
Then I should have 8 apples
Scenario: Found more apples
When I found 2 apples
Then I should have 5 apples
Scenario Outline: Other situations
When I ate apples
And I found apples
Then I should have apples
Examples:
| ate | found | result |
| 3 | 1 | 1 |
| 0 | 4 | 7 |
| 2 | 2 | 3 |
"""
Scenario: Run feature with failing scenarios
When I run "behat --no-colors -f progress"
Then it should pass with:
"""
.....................
6 scenarios (6 passed)
21 steps (21 passed)
"""
PK m%CV<5ծ) ) % features/bootstrap/FeatureContext.phpnu W+A
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Behat\Behat\Context\Context;
use Behat\Gherkin\Node\PyStringNode;
use Symfony\Component\Process\PhpExecutableFinder;
use Symfony\Component\Process\Process;
/**
* Behat test suite context.
*
* @author Konstantin Kudryashov
*/
class FeatureContext implements Context
{
/**
* @var string
*/
private $phpBin;
/**
* @var Process
*/
private $process;
/**
* @var string
*/
private $workingDir;
/**
* Cleans test folders in the temporary directory.
*
* @BeforeSuite
* @AfterSuite
*/
public static function cleanTestFolders()
{
if (is_dir($dir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'behat')) {
self::clearDirectory($dir);
}
}
/**
* Prepares test folders in the temporary directory.
*
* @BeforeScenario
*/
public function prepareTestFolders()
{
$dir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'behat' . DIRECTORY_SEPARATOR .
md5(microtime() * rand(0, 10000));
mkdir($dir . '/features/bootstrap/i18n', 0777, true);
mkdir($dir . '/junit');
$phpFinder = new PhpExecutableFinder();
if (false === $php = $phpFinder->find()) {
throw new \RuntimeException('Unable to find the PHP executable.');
}
$this->workingDir = $dir;
$this->phpBin = $php;
$this->process = new Process(null);
}
/**
* Creates a file with specified name and context in current workdir.
*
* @Given /^(?:there is )?a file named "([^"]*)" with:$/
*
* @param string $filename name of the file (relative path)
* @param PyStringNode $content PyString string instance
*/
public function aFileNamedWith($filename, PyStringNode $content)
{
$content = strtr((string) $content, array("'''" => '"""'));
$this->createFile($this->workingDir . '/' . $filename, $content);
}
/**
* Moves user to the specified path.
*
* @Given /^I am in the "([^"]*)" path$/
*
* @param string $path
*/
public function iAmInThePath($path)
{
$this->moveToNewPath($path);
}
/**
* Checks whether a file at provided path exists.
*
* @Given /^file "([^"]*)" should exist$/
*
* @param string $path
*/
public function fileShouldExist($path)
{
PHPUnit_Framework_Assert::assertFileExists($this->workingDir . DIRECTORY_SEPARATOR . $path);
}
/**
* Sets specified ENV variable
*
* @When /^"BEHAT_PARAMS" environment variable is set to:$/
*
* @param PyStringNode $value
*/
public function iSetEnvironmentVariable(PyStringNode $value)
{
$this->process->setEnv(array('BEHAT_PARAMS' => (string) $value));
}
/**
* Runs behat command with provided parameters
*
* @When /^I run "behat(?: ((?:\"|[^"])*))?"$/
*
* @param string $argumentsString
*/
public function iRunBehat($argumentsString = '')
{
$argumentsString = strtr($argumentsString, array('\'' => '"'));
$this->process->setWorkingDirectory($this->workingDir);
$this->process->setCommandLine(
sprintf(
'%s %s %s %s',
$this->phpBin,
escapeshellarg(BEHAT_BIN_PATH),
$argumentsString,
strtr('--format-settings=\'{"timer": false}\'', array('\'' => '"', '"' => '\"'))
)
);
// Don't reset the LANG variable on HHVM, because it breaks HHVM itself
if (!defined('HHVM_VERSION')) {
$env = $this->process->getEnv();
$env['LANG'] = 'en'; // Ensures that the default language is en, whatever the OS locale is.
$this->process->setEnv($env);
}
$this->process->start();
$this->process->wait();
}
/**
* Checks whether previously ran command passes|fails with provided output.
*
* @Then /^it should (fail|pass) with:$/
*
* @param string $success "fail" or "pass"
* @param PyStringNode $text PyString text instance
*/
public function itShouldPassWith($success, PyStringNode $text)
{
$this->itShouldFail($success);
$this->theOutputShouldContain($text);
}
/**
* Checks whether previously runned command passes|failes with no output.
*
* @Then /^it should (fail|pass) with no output$/
*
* @param string $success "fail" or "pass"
*/
public function itShouldPassWithNoOutput($success)
{
$this->itShouldFail($success);
PHPUnit_Framework_Assert::assertEmpty($this->getOutput());
}
/**
* Checks whether specified file exists and contains specified string.
*
* @Then /^"([^"]*)" file should contain:$/
*
* @param string $path file path
* @param PyStringNode $text file content
*/
public function fileShouldContain($path, PyStringNode $text)
{
$path = $this->workingDir . '/' . $path;
PHPUnit_Framework_Assert::assertFileExists($path);
$fileContent = trim(file_get_contents($path));
// Normalize the line endings in the output
if ("\n" !== PHP_EOL) {
$fileContent = str_replace(PHP_EOL, "\n", $fileContent);
}
PHPUnit_Framework_Assert::assertEquals($this->getExpectedOutput($text), $fileContent);
}
/**
* Checks whether specified content and structure of the xml is correct without worrying about layout.
*
* @Then /^"([^"]*)" file xml should be like:$/
*
* @param string $path file path
* @param PyStringNode $text file content
*/
public function fileXmlShouldBeLike($path, PyStringNode $text)
{
$path = $this->workingDir . '/' . $path;
PHPUnit_Framework_Assert::assertFileExists($path);
$fileContent = trim(file_get_contents($path));
$dom = new DOMDocument();
$dom->loadXML($text);
$dom->formatOutput = true;
PHPUnit_Framework_Assert::assertEquals(trim($dom->saveXML(null, LIBXML_NOEMPTYTAG)), $fileContent);
}
/**
* Checks whether last command output contains provided string.
*
* @Then the output should contain:
*
* @param PyStringNode $text PyString text instance
*/
public function theOutputShouldContain(PyStringNode $text)
{
PHPUnit_Framework_Assert::assertContains($this->getExpectedOutput($text), $this->getOutput());
}
private function getExpectedOutput(PyStringNode $expectedText)
{
$text = strtr($expectedText, array('\'\'\'' => '"""', '%%TMP_DIR%%' => sys_get_temp_dir() . DIRECTORY_SEPARATOR));
// windows path fix
if ('/' !== DIRECTORY_SEPARATOR) {
$text = preg_replace_callback(
'/[ "]features\/[^\n "]+/', function ($matches) {
return str_replace('/', DIRECTORY_SEPARATOR, $matches[0]);
}, $text
);
$text = preg_replace_callback(
'/\features\/[^\<]+/', function ($matches) {
return str_replace('/', DIRECTORY_SEPARATOR, $matches[0]);
}, $text
);
$text = preg_replace_callback(
'/\+[fd] [^ ]+/', function ($matches) {
return str_replace('/', DIRECTORY_SEPARATOR, $matches[0]);
}, $text
);
}
return $text;
}
/**
* Checks whether previously ran command failed|passed.
*
* @Then /^it should (fail|pass)$/
*
* @param string $success "fail" or "pass"
*/
public function itShouldFail($success)
{
if ('fail' === $success) {
if (0 === $this->getExitCode()) {
echo 'Actual output:' . PHP_EOL . PHP_EOL . $this->getOutput();
}
PHPUnit_Framework_Assert::assertNotEquals(0, $this->getExitCode());
} else {
if (0 !== $this->getExitCode()) {
echo 'Actual output:' . PHP_EOL . PHP_EOL . $this->getOutput();
}
PHPUnit_Framework_Assert::assertEquals(0, $this->getExitCode());
}
}
/**
* Checks whether the file is valid according to an XML schema.
*
* @Then /^the file "([^"]+)" should be a valid document according to "([^"]+)"$/
*
* @param string $xmlFile
* @param string $schemaPath relative to features/bootstrap/schema
*/
public function xmlShouldBeValid($xmlFile, $schemaPath)
{
$dom = new DomDocument();
$dom->load($this->workingDir . '/' . $xmlFile);
$dom->schemaValidate(__DIR__ . '/schema/' . $schemaPath);
}
private function getExitCode()
{
return $this->process->getExitCode();
}
private function getOutput()
{
$output = $this->process->getErrorOutput() . $this->process->getOutput();
// Normalize the line endings in the output
if ("\n" !== PHP_EOL) {
$output = str_replace(PHP_EOL, "\n", $output);
}
// Replace wrong warning message of HHVM
$output = str_replace('Notice: Undefined index: ', 'Notice: Undefined offset: ', $output);
return trim(preg_replace("/ +$/m", '', $output));
}
private function createFile($filename, $content)
{
$path = dirname($filename);
$this->createDirectory($path);
file_put_contents($filename, $content);
}
private function createDirectory($path)
{
if (!is_dir($path)) {
mkdir($path, 0777, true);
}
}
private function moveToNewPath($path)
{
$newWorkingDir = $this->workingDir .'/' . $path;
if (!file_exists($newWorkingDir)) {
mkdir($newWorkingDir, 0777, true);
}
$this->workingDir = $newWorkingDir;
}
private static function clearDirectory($path)
{
$files = scandir($path);
array_shift($files);
array_shift($files);
foreach ($files as $file) {
$file = $path . DIRECTORY_SEPARATOR . $file;
if (is_dir($file)) {
self::clearDirectory($file);
} else {
unlink($file);
}
}
rmdir($path);
}
}
PK m%CVZ|5 5 # features/bootstrap/schema/junit.xsdnu W+A
PK m%CVqt^o o features/arguments.featurenu W+A Feature: Step Arguments
In order to write extended steps
As a feature writer
I need an ability to specify Table & PyString arguments to steps
Background:
Given a file named "features/bootstrap/FeatureContext.php" with:
"""
strings[1] = "hello,\n w\n o\nr\nl\n d";
$this->tables[1] = array(
array('item1' => 'super', 'item2' => 'mega', 'item3' => 'extra'),
array('item1' => 'hyper', 'item2' => 'mini', 'item3' => 'XXL'),
);
}
/**
* @Given /^a pystring:$/
*/
public function aPystring(PyStringNode $string) {
$this->input = $string;
}
/**
* @Given /^a table:$/
*/
public function aTable(TableNode $table) {
$this->input = $table;
}
/**
* @Then /^it must be equals to string (\d+)$/
*/
public function itMustBeEqualsToString($number) {
\PHPUnit_Framework_Assert::assertEquals($this->strings[intval($number)], (string) $this->input);
}
/**
* @Then /^it must be equals to table (\d+)$/
*/
public function itMustBeEqualsToTable($number) {
\PHPUnit_Framework_Assert::assertEquals($this->tables[intval($number)], $this->input->getHash());
}
/**
* @Given /^I have number2 = (?P\d+) and number1 = (?P\d+)$/
*/
public function iHaveNumberAndNumber($number1, $number2) {
\PHPUnit_Framework_Assert::assertEquals(13, intval($number1));
\PHPUnit_Framework_Assert::assertEquals(243, intval($number2));
}
}
"""
Scenario: PyStrings
Given a file named "features/pystring.feature" with:
"""
Feature: PyStrings
Scenario:
Given a pystring:
'''
hello,
w
o
r
l
d
'''
Then it must be equals to string 1
"""
When I run "behat --no-colors -f progress features/pystring.feature"
Then it should pass with:
"""
..
1 scenario (1 passed)
2 steps (2 passed)
"""
Scenario: PyString tokens
Given a file named "features/pystring_tokens.feature" with:
"""
Feature: PyStrings
Scenario Outline:
Given a pystring:
'''
w
o
r
d
'''
Then it must be equals to string 1
Examples:
| word1 | word2 |
| hello, | l |
"""
When I run "behat --no-colors -f progress features/pystring_tokens.feature"
Then it should pass with:
"""
..
1 scenario (1 passed)
2 steps (2 passed)
"""
Scenario: Table tokens
Given a file named "features/table_tokens.feature" with:
"""
Feature: Tables
Scenario Outline:
Given a table:
| item1 | item2 | item3 |
| | | extra |
| hyper | mini | |
Then it must be equals to table 1
Examples:
| word1 | word2 | word3 |
| super | XXL | mega |
"""
When I run "behat --no-colors -f progress features/table_tokens.feature"
Then it should pass with:
"""
..
1 scenario (1 passed)
2 steps (2 passed)
"""
Scenario: Table
Given a file named "features/table.feature" with:
"""
Feature: Tables
Scenario:
Given a table:
| item1 | item2 | item3 |
| super | mega | extra |
| hyper | mini | XXL |
Then it must be equals to table 1
"""
When I run "behat --no-colors -f progress features/table.feature"
Then it should pass with:
"""
..
1 scenario (1 passed)
2 steps (2 passed)
"""
Scenario: Named arguments
Given a file named "features/named_args.feature" with:
"""
Feature: Named arguments
In order to maintain i18n for steps
As a step developer
I need to be able to declare regex with named parameters
Scenario:
Given I have number2 = 243 and number1 = 13
"""
When I run "behat --no-colors -f progress features/named_args.feature "
Then it should pass with:
"""
.
1 scenario (1 passed)
1 step (1 passed)
"""
PK m%CVR@y= = % features/definitions_patterns.featurenu W+A Feature: Step Definition Pattern
In order to fix my mistakes easily
As a step definitions developer
I need to be able to use complex and weird patterns
Scenario: Pattern with token at the start of the step
Given a file named "features/bootstrap/FeatureContext.php" with:
"""
.*)")? should(? not)? be:$/
*/
public function checkEquality($path = null, $isNegative = null, PyStringNode $json = null)
{
PHPUnit_Framework_Assert::assertNull($path);
PHPUnit_Framework_Assert::assertNull($isNegative);
PHPUnit_Framework_Assert::assertNotNull($json);
}
/**
* @Then /^the other (?:JSON|json)(?: response)?(?: at "(?.*)")? should(? not)? be:$/
*/
public function checkEquality2($json = null, $path = null, $isNegative = null)
{
PHPUnit_Framework_Assert::assertNull($path);
PHPUnit_Framework_Assert::assertNull($isNegative);
PHPUnit_Framework_Assert::assertNotNull($json);
}
}
"""
And a file named "features/step_patterns.feature" with:
"""
Feature: Step Pattern
Scenario:
Then the JSON should be:
'''
Test
'''
And the other JSON should be:
'''
Test
'''
"""
When I run "behat -f progress --no-colors"
Then it should pass with:
"""
..
1 scenario (1 passed)
2 steps (2 passed)
"""
Scenario: Definition parameter with decimal number following string
Given a file named "features/bootstrap/FeatureContext.php" with:
"""
parameters = $parameters;
}
/**
* @Given /^I have (\d+) apples?$/
*/
public function iHaveApples($count) {
$this->apples = intval($count);
}
/**
* @When /^I ate (\d+) apples?$/
*/
public function iAteApples($count) {
$this->apples -= intval($count);
}
/**
* @When /^I found (\d+) apples?$/
*/
public function iFoundApples($count) {
$this->apples += intval($count);
}
/**
* @Then /^I should have (\d+) apples$/
*/
public function iShouldHaveApples($count) {
PHPUnit_Framework_Assert::assertEquals(intval($count), $this->apples);
}
/**
* @Then /^context parameter "([^"]*)" should be equal to "([^"]*)"$/
*/
public function contextParameterShouldBeEqualTo($key, $val) {
PHPUnit_Framework_Assert::assertEquals($val, $this->parameters[$key]);
}
/**
* @Given /^context parameter "([^"]*)" should be array with (\d+) elements$/
*/
public function contextParameterShouldBeArrayWithElements($key, $count) {
PHPUnit_Framework_Assert::assertInternalType('array', $this->parameters[$key]);
PHPUnit_Framework_Assert::assertEquals(2, count($this->parameters[$key]));
}
}
"""
And a file named "features/apples.feature" with:
"""
Feature: Apples story
In order to eat apple
As a little kid
I need to have an apple in my pocket
Background:
Given I have 3 apples
Scenario: I'm little hungry
When I ate 1 apple
Then I should have 3 apples
Scenario: Found more apples
When I found 5 apples
Then I should have 8 apples
Scenario: Found more apples
When I found 2 apples
Then I should have 5 apples
And do something undefined
Scenario Outline: Other situations
When I ate apples
And I found apples
Then I should have apples
Examples:
| ate | found | result |
| 3 | 1 | 1 |
| 0 | 4 | 8 |
| 2 | 2 | 3 |
Scenario: Multilines
Given pystring:
'''
some pystring
'''
And table:
| col1 | col2 |
| val1 | val2 |
"""
Scenario: --no-colors option
When I run "behat --no-colors"
Then it should fail with:
"""
Feature: Apples story
In order to eat apple
As a little kid
I need to have an apple in my pocket
Background: # features/apples.feature:6
Given I have 3 apples # FeatureContext::iHaveApples()
Scenario: I'm little hungry # features/apples.feature:9
When I ate 1 apple # FeatureContext::iAteApples()
Then I should have 3 apples # FeatureContext::iShouldHaveApples()
Failed asserting that 2 matches expected 3.
Scenario: Found more apples # features/apples.feature:13
When I found 5 apples # FeatureContext::iFoundApples()
Then I should have 8 apples # FeatureContext::iShouldHaveApples()
Scenario: Found more apples # features/apples.feature:17
When I found 2 apples # FeatureContext::iFoundApples()
Then I should have 5 apples # FeatureContext::iShouldHaveApples()
And do something undefined
Scenario Outline: Other situations # features/apples.feature:22
When I ate apples # FeatureContext::iAteApples()
And I found apples # FeatureContext::iFoundApples()
Then I should have apples # FeatureContext::iShouldHaveApples()
Examples:
| ate | found | result |
| 3 | 1 | 1 |
| 0 | 4 | 8 |
Failed asserting that 7 matches expected 8.
| 2 | 2 | 3 |
Scenario: Multilines # features/apples.feature:33
Given pystring:
'''
some pystring
'''
And table:
| col1 | col2 |
| val1 | val2 |
--- Failed scenarios:
features/apples.feature:9
features/apples.feature:30
7 scenarios (3 passed, 2 failed, 2 undefined)
25 steps (20 passed, 2 failed, 3 undefined)
--- FeatureContext has missing steps. Define them with these snippets:
/**
* @Then /^do something undefined$/
*/
public function doSomethingUndefined()
{
throw new PendingException();
}
/**
* @Given /^pystring:$/
*/
public function pystring(PyStringNode $string)
{
throw new PendingException();
}
/**
* @Given /^table:$/
*/
public function table(TableNode $table)
{
throw new PendingException();
}
"""
Scenario: --no-paths option
When I run "behat --no-colors --format-settings='{\"paths\": false}'"
Then it should fail with:
"""
Feature: Apples story
In order to eat apple
As a little kid
I need to have an apple in my pocket
Background:
Given I have 3 apples
Scenario: I'm little hungry
When I ate 1 apple
Then I should have 3 apples
Failed asserting that 2 matches expected 3.
Scenario: Found more apples
When I found 5 apples
Then I should have 8 apples
Scenario: Found more apples
When I found 2 apples
Then I should have 5 apples
And do something undefined
Scenario Outline: Other situations
When I ate apples
And I found apples
Then I should have apples
Examples:
| ate | found | result |
| 3 | 1 | 1 |
| 0 | 4 | 8 |
Failed asserting that 7 matches expected 8.
| 2 | 2 | 3 |
Scenario: Multilines
Given pystring:
'''
some pystring
'''
And table:
| col1 | col2 |
| val1 | val2 |
--- Failed scenarios:
features/apples.feature:9
features/apples.feature:30
7 scenarios (3 passed, 2 failed, 2 undefined)
25 steps (20 passed, 2 failed, 3 undefined)
--- FeatureContext has missing steps. Define them with these snippets:
/**
* @Then /^do something undefined$/
*/
public function doSomethingUndefined()
{
throw new PendingException();
}
/**
* @Given /^pystring:$/
*/
public function pystring(PyStringNode $string)
{
throw new PendingException();
}
/**
* @Given /^table:$/
*/
public function table(TableNode $table)
{
throw new PendingException();
}
"""
Scenario: --no-snippets option
When I run "behat --no-colors --no-snippets"
Then it should fail with:
"""
Feature: Apples story
In order to eat apple
As a little kid
I need to have an apple in my pocket
Background: # features/apples.feature:6
Given I have 3 apples # FeatureContext::iHaveApples()
Scenario: I'm little hungry # features/apples.feature:9
When I ate 1 apple # FeatureContext::iAteApples()
Then I should have 3 apples # FeatureContext::iShouldHaveApples()
Failed asserting that 2 matches expected 3.
Scenario: Found more apples # features/apples.feature:13
When I found 5 apples # FeatureContext::iFoundApples()
Then I should have 8 apples # FeatureContext::iShouldHaveApples()
Scenario: Found more apples # features/apples.feature:17
When I found 2 apples # FeatureContext::iFoundApples()
Then I should have 5 apples # FeatureContext::iShouldHaveApples()
And do something undefined
Scenario Outline: Other situations # features/apples.feature:22
When I ate apples # FeatureContext::iAteApples()
And I found apples # FeatureContext::iFoundApples()
Then I should have apples # FeatureContext::iShouldHaveApples()
Examples:
| ate | found | result |
| 3 | 1 | 1 |
| 0 | 4 | 8 |
Failed asserting that 7 matches expected 8.
| 2 | 2 | 3 |
Scenario: Multilines # features/apples.feature:33
Given pystring:
'''
some pystring
'''
And table:
| col1 | col2 |
| val1 | val2 |
--- Failed scenarios:
features/apples.feature:9
features/apples.feature:30
7 scenarios (3 passed, 2 failed, 2 undefined)
25 steps (20 passed, 2 failed, 3 undefined)
"""
Scenario: --expand option
When I run "behat --no-colors --format-settings='{\"expand\": true}'"
Then it should fail with:
"""
Feature: Apples story
In order to eat apple
As a little kid
I need to have an apple in my pocket
Background: # features/apples.feature:6
Given I have 3 apples # FeatureContext::iHaveApples()
Scenario: I'm little hungry # features/apples.feature:9
When I ate 1 apple # FeatureContext::iAteApples()
Then I should have 3 apples # FeatureContext::iShouldHaveApples()
Failed asserting that 2 matches expected 3.
Scenario: Found more apples # features/apples.feature:13
When I found 5 apples # FeatureContext::iFoundApples()
Then I should have 8 apples # FeatureContext::iShouldHaveApples()
Scenario: Found more apples # features/apples.feature:17
When I found 2 apples # FeatureContext::iFoundApples()
Then I should have 5 apples # FeatureContext::iShouldHaveApples()
And do something undefined
Scenario Outline: Other situations # features/apples.feature:22
When I ate apples
And I found apples
Then I should have apples
Examples:
| ate | found | result |
| 3 | 1 | 1 | # features/apples.feature:29
When I ate 3 apples # FeatureContext::iAteApples()
And I found 1 apples # FeatureContext::iFoundApples()
Then I should have 1 apples # FeatureContext::iShouldHaveApples()
| 0 | 4 | 8 | # features/apples.feature:30
When I ate 0 apples # FeatureContext::iAteApples()
And I found 4 apples # FeatureContext::iFoundApples()
Then I should have 8 apples # FeatureContext::iShouldHaveApples()
Failed asserting that 7 matches expected 8.
| 2 | 2 | 3 | # features/apples.feature:31
When I ate 2 apples # FeatureContext::iAteApples()
And I found 2 apples # FeatureContext::iFoundApples()
Then I should have 3 apples # FeatureContext::iShouldHaveApples()
Scenario: Multilines # features/apples.feature:33
Given pystring:
'''
some pystring
'''
And table:
| col1 | col2 |
| val1 | val2 |
--- Failed scenarios:
features/apples.feature:9
features/apples.feature:30
7 scenarios (3 passed, 2 failed, 2 undefined)
25 steps (20 passed, 2 failed, 3 undefined)
--- FeatureContext has missing steps. Define them with these snippets:
/**
* @Then /^do something undefined$/
*/
public function doSomethingUndefined()
{
throw new PendingException();
}
/**
* @Given /^pystring:$/
*/
public function pystring(PyStringNode $string)
{
throw new PendingException();
}
/**
* @Given /^table:$/
*/
public function table(TableNode $table)
{
throw new PendingException();
}
"""
Scenario: --no-multiline option
When I run "behat --no-colors --format-settings='{\"multiline\": false}'"
Then it should fail with:
"""
Feature: Apples story
In order to eat apple
As a little kid
I need to have an apple in my pocket
Background: # features/apples.feature:6
Given I have 3 apples # FeatureContext::iHaveApples()
Scenario: I'm little hungry # features/apples.feature:9
When I ate 1 apple # FeatureContext::iAteApples()
Then I should have 3 apples # FeatureContext::iShouldHaveApples()
Failed asserting that 2 matches expected 3.
Scenario: Found more apples # features/apples.feature:13
When I found 5 apples # FeatureContext::iFoundApples()
Then I should have 8 apples # FeatureContext::iShouldHaveApples()
Scenario: Found more apples # features/apples.feature:17
When I found 2 apples # FeatureContext::iFoundApples()
Then I should have 5 apples # FeatureContext::iShouldHaveApples()
And do something undefined
Scenario Outline: Other situations # features/apples.feature:22
When I ate apples # FeatureContext::iAteApples()
And I found apples # FeatureContext::iFoundApples()
Then I should have apples # FeatureContext::iShouldHaveApples()
Examples:
| ate | found | result |
| 3 | 1 | 1 |
| 0 | 4 | 8 |
Failed asserting that 7 matches expected 8.
| 2 | 2 | 3 |
Scenario: Multilines # features/apples.feature:33
Given pystring:
...
And table:
...
--- Failed scenarios:
features/apples.feature:9
features/apples.feature:30
7 scenarios (3 passed, 2 failed, 2 undefined)
25 steps (20 passed, 2 failed, 3 undefined)
--- FeatureContext has missing steps. Define them with these snippets:
/**
* @Then /^do something undefined$/
*/
public function doSomethingUndefined()
{
throw new PendingException();
}
/**
* @Given /^pystring:$/
*/
public function pystring(PyStringNode $string)
{
throw new PendingException();
}
/**
* @Given /^table:$/
*/
public function table(TableNode $table)
{
throw new PendingException();
}
"""
PK m%CV:Wq q features/config.featurenu W+A Feature: Config
In order to configure behat for my needs
As a feature automator
I need to be able to use behat configuration file
Scenario: Empty configuration file
Given a file named "behat.yml" with:
"""
"""
And a file named "features/bootstrap/FeatureContext.php" with:
"""
apples
And I found apples
Then I should have apples
Examples:
| ate | found | result |
| 3 | 1 | 1 |
| 0 | 4 | 8 |
| 2 | 2 | 3 |
"""
Scenario: Just run feature
When I run "behat --no-colors --format-settings='{\"paths\": false}' features/apples.feature"
Then it should pass with:
"""
Feature: Apples story
In order to eat apple
As a little kid
I need to have an apple in my pocket
Background:
Given I have 3 apples
│ STEP: I have 3 apples
┌─ @BeforeScenario # FeatureContext::beforeScenario()
│
│ HOOK: before scenario
│
Scenario: I'm little hungry
When I ate 1 apple
│ STEP: I ate 1 apples
Then I should have 3 apples
│ STEP: I should have 3 apples
┌─ @BeforeScenario # FeatureContext::beforeScenario()
│
│ HOOK: before scenario
│
Scenario: Found more apples
Given I have 3 apples
│ STEP: I have 3 apples
When I found 5 apples
│ STEP: I found 5 apples
Then I should have 8 apples
│ STEP: I should have 8 apples
┌─ @BeforeScenario # FeatureContext::beforeScenario()
│
│ HOOK: before scenario
│
Scenario: Found more apples
Given I have 3 apples
│ STEP: I have 3 apples
When I found 2 apples
│ STEP: I found 2 apples
Then I should have 5 apples
│ STEP: I should have 5 apples
Scenario Outline: Other situations
When I ate apples
And I found apples
Then I should have apples
Examples:
| ate | found | result |
┌─ @BeforeScenario # FeatureContext::beforeScenario()
│
│ HOOK: before scenario
│
| 3 | 1 | 1 |
│ STEP: I have 3 apples
│ STEP: I ate 3 apples
│ STEP: I found 1 apples
│ STEP: I should have 1 apples
┌─ @BeforeScenario # FeatureContext::beforeScenario()
│
│ HOOK: before scenario
│
| 0 | 4 | 8 |
│ STEP: I have 3 apples
│ STEP: I ate 0 apples
│ STEP: I found 4 apples
│ STEP: I should have 8 apples
┌─ @BeforeScenario # FeatureContext::beforeScenario()
│
│ HOOK: before scenario
│
| 2 | 2 | 3 |
│ STEP: I have 3 apples
│ STEP: I ate 2 apples
│ STEP: I found 2 apples
│ STEP: I should have 3 apples
6 scenarios (6 passed)
21 steps (21 passed)
"""
Scenario: Run feature with --dry-run
When I run "behat --no-colors --dry-run features/apples.feature"
Then it should pass with:
"""
Feature: Apples story
In order to eat apple
As a little kid
I need to have an apple in my pocket
Background: # features/apples.feature:6
Given I have 3 apples # FeatureContext::iHaveApples()
Scenario: I'm little hungry # features/apples.feature:9
When I ate 1 apple # FeatureContext::iAteApples()
Then I should have 3 apples # FeatureContext::iShouldHaveApples()
Scenario: Found more apples # features/apples.feature:13
When I found 5 apples # FeatureContext::iFoundApples()
Then I should have 8 apples # FeatureContext::iShouldHaveApples()
Scenario: Found more apples # features/apples.feature:17
When I found 2 apples # FeatureContext::iFoundApples()
Then I should have 5 apples # FeatureContext::iShouldHaveApples()
Scenario Outline: Other situations # features/apples.feature:21
When I ate apples # FeatureContext::iAteApples()
And I found apples # FeatureContext::iFoundApples()
Then I should have apples # FeatureContext::iShouldHaveApples()
Examples:
| ate | found | result |
| 3 | 1 | 1 |
| 0 | 4 | 8 |
| 2 | 2 | 3 |
--- Skipped scenarios:
features/apples.feature:9
features/apples.feature:13
features/apples.feature:17
features/apples.feature:28
features/apples.feature:29
features/apples.feature:30
6 scenarios (6 skipped)
21 steps (21 skipped)
"""
PK m%CV'&; &; features/pretty_format.featurenu W+A Feature: Pretty Formatter
In order to debug features
As a feature writer
I need to have pretty formatter
Scenario: Complex
Given a file named "features/bootstrap/FeatureContext.php" with:
"""
value = $num;
}
/**
* @Then /I must have (\d+)/
*/
public function iMustHave($num) {
PHPUnit_Framework_Assert::assertEquals($num, $this->value);
}
/**
* @When /I add (\d+)/
*/
public function iAdd($num) {
$this->value += $num;
}
/**
* @When /^Something not done yet$/
*/
public function somethingNotDoneYet() {
throw new PendingException();
}
}
"""
And a file named "features/World.feature" with:
"""
Feature: World consistency
In order to maintain stable behaviors
As a features developer
I want, that "World" flushes between scenarios
Background:
Given I have entered 10
Scenario: Undefined
Then I must have 10
And Something new
Then I must have 10
Scenario: Pending
Then I must have 10
And Something not done yet
Then I must have 10
Scenario: Failed
When I add 4
Then I must have 13
Scenario Outline: Passed & Failed
Given I must have 10
When I add
Then I must have
Examples:
| value | result |
| 5 | 16 |
| 10 | 20 |
| 23 | 32 |
"""
When I run "behat --no-colors -f pretty"
Then it should fail with:
"""
Feature: World consistency
In order to maintain stable behaviors
As a features developer
I want, that "World" flushes between scenarios
Background: # features/World.feature:6
Given I have entered 10 # FeatureContext::iHaveEntered()
Scenario: Undefined # features/World.feature:9
Then I must have 10 # FeatureContext::iMustHave()
And Something new
Then I must have 10 # FeatureContext::iMustHave()
Scenario: Pending # features/World.feature:14
Then I must have 10 # FeatureContext::iMustHave()
And Something not done yet # FeatureContext::somethingNotDoneYet()
TODO: write pending definition
Then I must have 10 # FeatureContext::iMustHave()
Scenario: Failed # features/World.feature:19
When I add 4 # FeatureContext::iAdd()
Then I must have 13 # FeatureContext::iMustHave()
Failed asserting that 14 matches expected '13'.
Scenario Outline: Passed & Failed # features/World.feature:23
Given I must have 10 # FeatureContext::iMustHave()
When I add # FeatureContext::iAdd()
Then I must have # FeatureContext::iMustHave()
Examples:
| value | result |
| 5 | 16 |
Failed asserting that 15 matches expected '16'.
| 10 | 20 |
| 23 | 32 |
Failed asserting that 33 matches expected '32'.
--- Failed scenarios:
features/World.feature:19
features/World.feature:30
features/World.feature:32
6 scenarios (1 passed, 3 failed, 1 undefined, 1 pending)
23 steps (16 passed, 3 failed, 1 undefined, 1 pending, 2 skipped)
--- FeatureContext has missing steps. Define them with these snippets:
/**
* @Then /^Something new$/
*/
public function somethingNew()
{
throw new PendingException();
}
"""
Scenario: Multiline titles
Given a file named "features/bootstrap/FeatureContext.php" with:
"""
value = $num;
}
/**
* @Then /I must have (\d+)/
*/
public function iMustHave($num) {
PHPUnit_Framework_Assert::assertEquals($num, $this->value);
}
/**
* @When /I (add|subtract) the value (\d+)/
*/
public function iAddOrSubtract($op, $num) {
if ($op == 'add')
$this->value += $num;
elseif ($op == 'subtract')
$this->value -= $num;
}
}
"""
And a file named "features/World.feature" with:
"""
Feature: World consistency
In order to maintain stable behaviors
As a features developer
I want, that "World" flushes between scenarios
Background:
Given I have entered 10
Scenario: Adding some interesting
value
Then I must have 10
And I add the value 6
Then I must have 16
Scenario: Subtracting
some
value
Then I must have 10
And I subtract the value 6
Then I must have 4
"""
When I run "behat --no-colors -f pretty"
Then it should pass with:
"""
Feature: World consistency
In order to maintain stable behaviors
As a features developer
I want, that "World" flushes between scenarios
Background: # features/World.feature:6
Given I have entered 10 # FeatureContext::iHaveEntered()
Scenario: Adding some interesting # features/World.feature:9
value
Then I must have 10 # FeatureContext::iMustHave()
And I add the value 6 # FeatureContext::iAddOrSubtract()
Then I must have 16 # FeatureContext::iMustHave()
Scenario: Subtracting # features/World.feature:15
some
value
Then I must have 10 # FeatureContext::iMustHave()
And I subtract the value 6 # FeatureContext::iAddOrSubtract()
Then I must have 4 # FeatureContext::iMustHave()
2 scenarios (2 passed)
8 steps (8 passed)
"""
Scenario: Don't print undefined exceptions in outline
Given a file named "features/bootstrap/FeatureContext.php" with:
"""
value);
}
/**
* @When /I add "([^"]+)"/
*/
public function iAdd($num) {
$this->value += intval(preg_replace('/[^\d]+/', '', $num));
}
}
"""
And a file named "features/ls.feature" with:
"""
Feature: ls
In order to see the directory structure
As a UNIX user
I need to be able to list the current directory's contents
Background:
Given I have a file named "foo"
Scenario: List 2 files in a directory
Given I have a file named "bar"
When I run "ls"
Then I should see "bar" in output
And I should see "foo" in output
Scenario: List 1 file and 1 dir
Given I have a directory named "dir"
When I run "ls"
Then I should see "dir" in output
And I should see "foo" in output
Scenario Outline:
Given I have a