Git Product home page Git Product logo

gherkin's Introduction

Behat Gherkin Parser

This is the php Gherkin parser for Behat. It comes bundled with more than 40 native languages (see i18n.php) support & clean architecture.

Useful Links

Usage Example

<?php

$keywords = new Behat\Gherkin\Keywords\ArrayKeywords(array(
    'en' => array(
        'feature'          => 'Feature',
        'background'       => 'Background',
        'scenario'         => 'Scenario',
        'scenario_outline' => 'Scenario Outline|Scenario Template',
        'examples'         => 'Examples|Scenarios',
        'given'            => 'Given',
        'when'             => 'When',
        'then'             => 'Then',
        'and'              => 'And',
        'but'              => 'But'
    ),
    'en-pirate' => array(
        'feature'          => 'Ahoy matey!',
        'background'       => 'Yo-ho-ho',
        'scenario'         => 'Heave to',
        'scenario_outline' => 'Shiver me timbers',
        'examples'         => 'Dead men tell no tales',
        'given'            => 'Gangway!',
        'when'             => 'Blimey!',
        'then'             => 'Let go and haul',
        'and'              => 'Aye',
        'but'              => 'Avast!'
    )
));
$lexer  = new Behat\Gherkin\Lexer($keywords);
$parser = new Behat\Gherkin\Parser($lexer);

$feature = $parser->parse(file_get_contents('some.feature'));

Installing Dependencies

$> curl http://getcomposer.org/installer | php
$> php composer.phar update

Contributors

gherkin's People

Contributors

anbotero avatar andreybolonin avatar antham avatar arnegroskurth avatar benja-m-1 avatar ciaranmcnulty avatar docteurklein avatar dpakach avatar everzet avatar generalconsensus avatar github-actions[bot] avatar glennmcewan avatar headrevision avatar iwfy avatar kibao avatar latvianization avatar magikid avatar mathiasverraes avatar mvorisek avatar niklasbr avatar pamil avatar pfrenssen avatar phil-davis avatar purplebooth avatar simonhammes avatar simonschaufi avatar stof avatar traviscarden avatar tuanphpvn avatar unkind avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gherkin's Issues

Ignore trailing spaces and/or optional period?

Is there any interest in a patch to trim trailing spaces when parsing steps? and/or ignore a trailing period? e.g.,

Then I should see "this".  

This came about from seeing some of the Behat tests that were being written by our QA group that were "unexpectedly" failing.

Collect comments for nodes

I found myself wanting to access the comments for a particular node and noticed that this package does not seem to do that. Are there any plans for this? I found (I believe) a fairly simple way to pull them in for each node. If I did a PR would you even consider it, or are accessing the comments outside the scope of what you want this package to do?

Thanks!

Enable modifying TableNode data during runtime

Hi, I have a question before making any changes that might not be complying to a design pattern or a concept.

I'm considering adding setters to https://github.com/Behat/Gherkin/blob/master/src/Behat/Gherkin/Node/TableNode.php class.

The reasoning:
I want to use a human readable date like "in 1 week" as a cell data in a table, which is later converted to a timestamp by a http://docs.behat.org/en/v2.5/guides/3.hooks.html#step-hooks
Currently, the data from the table is iterable, but not modifiable with a method.

When the date is in a regular step the transforms would be ok, but I haven't found any other ideas on how to transform/modify data in table cells.

Please tell me if this way of thinking is wrong and if I'm missing a standard pattern I have to apply?

Thanks!

Fatal error: Interface 'Behat\Gherkin\Node\StepArgumentNodeInterface' not found in C:\PEAR\pear\gherkin\src\Behat\Gherkin\Node\TableNode.php on line 19

After upgrade Gherkin from 2.1.1 to 2.2.1 I got following error.

Fatal error: Interface 'Behat\Gherkin\Node\StepArgumentNodeInterface' not found in C:\PEAR\pear\gherkin\src\Behat\Gherkin\Node\TableNode.php on line 19

Call Stack:
    0.0005     332440   1. {main}() C:\PEAR\behat:0
    0.3759    2883176   2. Symfony\Component\Console\Application->run() C:\PEAR\behat:27
    0.4920    3215224   3. Symfony\Component\Console\Application->doRun() C:\PEAR\pear\Symfony\Component\Console\Application.php:118
    0.4928    3215272   4. Symfony\Component\Console\Command\Command->run() C:\PEAR\pear\Symfony\Component\Console\Application.php:194
    2.1888    9256416   5. Behat\Behat\Console\Command\BehatCommand->execute() C:\PEAR\pear\Symfony\Component\Console\Command\Command.php:224
    2.1888    9256416   6. Behat\Behat\Runner->runSuite() C:\PEAR\pear\behat\src\Behat\Behat\Console\Command\BehatCommand.php:80
   48.3010   37334992   7. Behat\Behat\Runner->runFeatures() C:\PEAR\pear\behat\src\Behat\Behat\Runner.php:160
   48.3010   37335288   8. Behat\Gherkin\Gherkin->load() C:\PEAR\pear\behat\src\Behat\Behat\Runner.php:176
   48.3030   37335408   9. Behat\Gherkin\Loader\GherkinFileLoader->load() C:\PEAR\pear\gherkin\src\Behat\Gherkin\Gherkin.php:97
   48.3036   37335536  10. Behat\Gherkin\Loader\GherkinFileLoader->parseFeature() C:\PEAR\pear\gherkin\src\Behat\Gherkin\Loader\GherkinFileLoader.php:83
   48.3339   37337712  11. Behat\Gherkin\Parser->parse() C:\PEAR\pear\gherkin\src\Behat\Gherkin\Loader\GherkinFileLoader.php:100
   48.3383   37345832  12. Behat\Gherkin\Parser->parseExpression() C:\PEAR\pear\gherkin\src\Behat\Gherkin\Parser.php:91
   48.3384   37345832  13. Behat\Gherkin\Parser->parseFeature() C:\PEAR\pear\gherkin\src\Behat\Gherkin\Parser.php:158
   48.3435   37417816  14. Behat\Gherkin\Parser->parseExpression() C:\PEAR\pear\gherkin\src\Behat\Gherkin\Parser.php:205
   48.3435   37417816  15. Behat\Gherkin\Parser->parseBackground() C:\PEAR\pear\gherkin\src\Behat\Gherkin\Parser.php:160
   48.3513   37499152  16. Behat\Gherkin\Parser->parseExpression() C:\PEAR\pear\gherkin\src\Behat\Gherkin\Parser.php:237
   48.3513   37499152  17. Behat\Gherkin\Parser->parseStep() C:\PEAR\pear\gherkin\src\Behat\Gherkin\Parser.php:170
   48.3530   37500600  18. Behat\Gherkin\Parser->parseExpression() C:\PEAR\pear\gherkin\src\Behat\Gherkin\Parser.php:323
   48.3530   37500600  19. Behat\Gherkin\Parser->parseTable() C:\PEAR\pear\gherkin\src\Behat\Gherkin\Parser.php:166
   48.3531   37500824  20. Behat\Behat\ClassLoader\MapFileClassLoader->loadClass() C:\PEAR\pear\gherkin\src\Behat\Gherkin\Parser.php:0
   48.3555   37554776  21. require('C:\PEAR\pear\gherkin\src\Behat\Gherkin\Node\TableNode.php') C:\PEAR\pear\behat\src\Behat\Behat\ClassLoader\MapFileClassLoade
r.php:55

Do not throw exception if loader is not found

Gherkins class should not throw exception if appropriate loader for resource is not found - it should return empty array. Throwing exception is a user responsibility in this case

Unknown token type: EOS

Hello,

I get the following error:

Unknown token type: EOS   

When parsing the following file:

Feature: Some feature
#

Is this expected behavior?

Scenario Outlines inconsistencies

Checking the parsing examples from Gherkin, the following fail due to issues with scenario outlines:

  • descriptions.feature - the description on the final Example causes a parse error [moved to #154]
  • incomplete_scenario_outline (and readme_example, scenario_outlines_with_tags, several_examples, tags) - scenario outlines without an Example are not allowed by our parser but are just ignored by cucumber
  • scenario_outline - Looks like Scenario keyword can be used for outlines now?

Wrong parsing with examples

Scenario Outline: I eat apples
    Given I have <start> apples
    When I eat <eat> apples
    Then I have <left> left

    Examples:
        | start | eat | left |
        | 3     | 1   | 2    |
        | 5     | 4   | 1    | # some comment

When executing this, it results in a PHP fatal error saying that array_combine has to have 2 arrays with equal lengths. It then shows this in the error message:

        | 5     | 4   | 1    | # some comment |

Background doesn't allow tags

I'd like to add some tags to my background, but Gherkin throws an exception "[Behat\Gherkin\Exception\ParserException] Expected Feature token, but got Tag on line: 6".

Example below:

Feature: Posts

  @database @postFixture @javascript
  Background:
    Given I am logged in as normal user
    And   I am on "/profile/"

  Scenario: I see all posts after logging in
    Then I should see a list of all current posts

  Scenario: abc etc.

Right now, I need to copy the tags to all scenarios, what do you think about allowing tags on background itself?

Regression when there are null values in TableNodes

We have null values in our features with tables in the cells.

I believe since #121 this is not possible anymore because the table cells must contain values that is_scalar evaluates to true.

I would argue, that null should be allowed.

API to get (partial) feature after Parser exception?

Unless I'm mistaken, $feature being scoped in Parser->parse() means that any attempt by the caller of parse() to catch exceptions will be unable to get the (partial) feature.

We're using Gherkin in a context where an invalid feature file isn't an exceptional case, and where partial information will be useful.

A hacky solution is to make $feature a property of Parser, and access that in the caller's catch block, (and I've implemented that on our project for now).

Dumping Keywords is not correct

Dumper does not dump keywords correctly if there are more than 2 of them.

When it was f.e. for feature "Feature|Business Need" then it worked ok but if it is "Feature|Business Need|Ability" like now then it dumps not the "Feature" keyword but "Feature|Business Need" instead.

Tags not inherited

following #1, it seems it is broken again, as in a ScenarioNode I don't have access to the FeatureNode's tags.

With the following feature file :

@foo
Feature: My Feature

@bar
Scenario: My Scenario
when ....

When dumping the tags of the scenario in a GherkinNodeTested event via $event->getNode()->getTags() (in Behat), I have

array:1 [
   0 => "bar"
]

And if I do a $event->getFeature()->getTags(), I have the following :

array:1 [
   0 => "foo"
]

While I was expecting to have

array:1 [
   0 => "foo",
   1 => "bar"
]

in my ScenarioNode::getTags()

Unless I missed something ?

Is it Possible to nest TableNodes?

Is there a way to nest TableNodes. i.e: A TableNode containing another TableNode in one of it's Cells I have not tried the obvious approach yet, to see if it works or not, because I haven't gotten to it's relevant Use Case in my Project yet.

Gherkin cache invalid since v4.5

Hey everyone, thanks for this awesome project!

We noticed that our Behat tests on Jenkins were slowly dying and after a couple of hours of debugging we noticed that the problem has something to do with outdated caches since the 4.5 update.

What happened was that you could run the whole unit as one, but when you tried to launch a single .feature file Behat was unable to find any specifications.

I deleted the caches and downgraded to Gherkin v4.4 and everything is back to normal. Did we miss something or was there a breaking change?

Cheers,
Mike

PyString isn't parsed correctly and causes php_warnings

When I used PyString inside my scenario (or scenario outline) and tried to run behat then I saw php warning:
Warning: preg_replace(): Compilation failed: numbers out of order in {} quantifier at offset 7 in /usr/share/pear/gherkin/src/Behat/Gherkin/Lexer.php on line 369

Call Stack:
0.0013 639736 1. {main}() /usr/bin/behat:0
0.1619 3881720 2. Symfony\Component\Console\Application->run() /usr/bin/behat:27
0.1848 4330136 3. Symfony\Component\Console\Application->doRun() /usr/share/pear/Symfony/Component/Console/Application.php:118
0.1853 4330216 4. Symfony\Component\Console\Command\Command->run() /usr/share/pear/Symfony/Component/Console/Application.php:194
1.1634 23649328 5. Behat\Behat\Console\Command\BehatCommand->execute() /usr/share/pear/Symfony/Component/Console/Command/Command.php:224
1.1634 23649328 6. Behat\Behat\Runner->run() /usr/share/pear/behat/src/Behat/Behat/Console/Command/BehatCommand.php:78
1.2226 27124784 7. Behat\Gherkin\Gherkin->load() /usr/share/pear/behat/src/Behat/Behat/Runner.php:94
1.2227 27125000 8. Behat\Gherkin\Loader\GherkinFileLoader->load() /usr/share/pear/gherkin/src/Behat/Gherkin/Gherkin.php:82
1.2229 27125792 9. Behat\Gherkin\Parser->parse() /usr/share/pear/gherkin/src/Behat/Gherkin/Loader/GherkinFileLoader.php:56
1.2611 27235696 10. Behat\Gherkin\Parser->parseExpression() /usr/share/pear/gherkin/src/Behat/Gherkin/Parser.php:80
1.2611 27235696 11. Behat\Gherkin\Parser->parseFeature() /usr/share/pear/gherkin/src/Behat/Gherkin/Parser.php:147
1.2629 27307888 12. Behat\Gherkin\Parser->parseExpression() /usr/share/pear/gherkin/src/Behat/Gherkin/Parser.php:223
1.2630 27307888 13. Behat\Gherkin\Parser->parseExpression() /usr/share/pear/gherkin/src/Behat/Gherkin/Parser.php:170
1.2630 27307888 14. Behat\Gherkin\Parser->parseScenario() /usr/share/pear/gherkin/src/Behat/Gherkin/Parser.php:151
1.2643 27368416 15. Behat\Gherkin\Parser->parseExpression() /usr/share/pear/gherkin/src/Behat/Gherkin/Parser.php:327
1.2643 27368416 16. Behat\Gherkin\Parser->parseStep() /usr/share/pear/gherkin/src/Behat/Gherkin/Parser.php:159
1.2651 27414992 17. Behat\Gherkin\Parser->parseExpression() /usr/share/pear/gherkin/src/Behat/Gherkin/Parser.php:347
1.2652 27414992 18. Behat\Gherkin\Parser->parsePyString() /usr/share/pear/gherkin/src/Behat/Gherkin/Parser.php:157
1.2687 27438256 19. Behat\Gherkin\Parser->predictTokenType() /usr/share/pear/gherkin/src/Behat/Gherkin/Parser.php:389
1.2687 27438304 20. Behat\Gherkin\Lexer->predictToken() /usr/share/pear/gherkin/src/Behat/Gherkin/Parser.php:135
1.2687 27438352 21. Behat\Gherkin\Lexer->getNextToken() /usr/share/pear/gherkin/src/Behat/Gherkin/Lexer.php:108
1.2687 27438352 22. Behat\Gherkin\Lexer->scanPyStringContent() /usr/share/pear/gherkin/src/Behat/Gherkin/Lexer.php:180
1.2687 27439288 23. preg_replace() /usr/share/pear/gherkin/src/Behat/Gherkin/Lexer.php:369

Parsing comments

Hi,

I would like to create command (i havent found it) to reindent feature files (and reformat TableNodes).

I have created Parser with Lexer, i have parsed a content file and i have used GherkinDumper to output reformated content. Comments and PyString aren't in new output :

  • PyString seems not to be supported in GherkinDumper
  • Comments aren't in var_dump($parser->parse($content)); (??)

Can you tell me what is the best matter to reindent feature (with TableNodes) ?

Thanks.

TableNode::getRowsHash() returns first column only

Assuming I have the following table:

| email  | [email protected] | [email protected] |
| name   | name 1       | name12        |
| phone  | 0800         | 0900          |

I have no way to iterate over the data columns. getRowsHash() takes into account the first data-column only (using fixed indexes).

As getHash() returns the data for all rows I'd suggest that getRowsHash() returns the data for all columns as well as a nested array of the same structure. As this would be a BC break an alternative would be to introduce a new function doing so.

I'd provide a patch for this. Waiting for feedback first though.

Tags are not parsed correctly

I have configured a filter for skipping incomplete tests

default:
  suites:
  ...
    filters:
      tags: ~@skipped

I have multiple files in the same directory. The first one contains the tag @Skipped in der first line. The second one doen't have the tag.

All scenarios of the second feature file are filtered because the Parser is using the Tags of the first feature file for the second file.

The parseFeature() method is using popTags() which sets tags to the value that the parser found the last time it was used.

Should not tags be reseted every time a new feature is parsed?

Escape pystring delimiters

Don't you think it should be possible to escape pystring delimiters (""")?
I'm having issues for dealing with GraphQL SDL because it is using the same delimiters for multiline comments.

Hierarchical view of features folder with scenarios

Hi,
I'd like to write something that recursively goes through the features folder and creates a hierarchical structure that represents the folder, it's features files and their scenarios.

Could this be done with the Gherkin library? I've been looking at the following classes to try to put together a solution but I haven't really solved it yet. I'm deeply grateful for any help I could get.

Behat\Gherkin\Loader\DirectoryLoader
\Behat\Gherkin\Gherkin
Behat\Gherkin\Loader\GherkinFileLoader
Behat\Gherkin\Parser
Behat\Gherkin\Lexer

Build failing on master branch

Builds are failing on all new pull requests (e.g., #120, #121) due to notices emitted by unit tests on the master branch on CI, presumably due to updates in the Symfony Yaml parser. Example:

$ ./vendor/bin/phpunit
PHPUnit 5.7.9 by Sebastian Bergmann and contributors.

...............................................................  63 / 252 ( 25%)
............................................................... 126 / 252 ( 50%)
............................................................... 189 / 252 ( 75%)
............................................................... 252 / 252 (100%)


Time: 4.75 seconds, Memory: 29.50MB

OK (252 tests, 621 assertions)

Remaining deprecation notices (4)

Duplicate key "type" detected on line 21 whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since version 3.2 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0: 1x
    1x in ParserTest::testParser from Tests\Behat\Gherkin

Duplicate key "type" detected on line 20 whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since version 3.2 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0: 1x
    1x in ParserTest::testParser from Tests\Behat\Gherkin

Duplicate key "type" detected on line 19 whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since version 3.2 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0: 1x
    1x in ParserTest::testParser from Tests\Behat\Gherkin

Duplicate key "type" detected on line 18 whilst parsing YAML. Silent handling of duplicate mapping keys in YAML is deprecated since version 3.2 and will throw \Symfony\Component\Yaml\Exception\ParseException in 4.0: 1x
    1x in ParserTest::testParser from Tests\Behat\Gherkin

Behat Gherkin cache invalidation

First of all, I don't know how to reproduce this problem so I guess it will be pretty hard to find out the cause.
What happened is that on our CI server the behat tests started to fail for some reason and we found out that behat is running test cases what are not in the tested code base, but were in another branch.
So one branches feature file leaked into another branch after switching.
We tried to invalidate opcode caches and check if there is anything cached maybe in the filesystem with no result. After a while we found a directory I wasn't aware of (/tmp/behat_gherkin_cache ) and just out of curiosity we removed it's content what fixed our tests again. Now we put a script into our CI process to remove the content of this directory before every run just in case.

Add i18n to RoleFilter

Currently, it only filters for As an. When I write a dutch feature, it'll be Als een ..., which isn't yet filtered.

[Multilang] Gherkin should fail if keyword does not exists

#language: nl
Functionaliteit: Xxxxxx

    Background:
        Given something is initialized

    Scenario: Yyyyyyy
         # ....

Loading the following spec should fail, since Background does not exists in the Dutch translation, Achtergrond should be used instead. However, Gherkin simply ignores the Background now and continues parsing the features.

Can't install Behat in a Symfony v2.2.0-BETA1 project

I'm trying to install Behat in a Symfony Standard Edition project using the latest Symfony version but it does not work. I think it is because of Behat/Gherkin because the latest tag uses the version <2.2-dev of the symfony/finder component.

I may be wrong, in that case how do you use Behat, Mink, Goutte and the Symfony2Extension on a Symfony project base on the version v2.2.0-BETA1?

Thanks :)

Unit tests have warning

e.g. https://travis-ci.org/Behat/Gherkin/jobs/480397897

$ vendor/bin/phpunit -v --coverage-clover=coverage.clover
PHPUnit 5.7.27 by Sebastian Bergmann and contributors.
Runtime:       PHP 5.6.32 with Xdebug 2.5.5
Configuration: /home/travis/build/Behat/Gherkin/phpunit.xml.dist
................................................W..............  63 / 190 ( 33%)
............................................................... 126 / 190 ( 66%)
............................................................... 189 / 190 ( 99%)
.                                                               190 / 190 (100%)
Time: 20.44 seconds, Memory: 28.75MB
There was 1 warning:
1) Warning
The data provider specified for Tests\Behat\Gherkin\Keywords\CachedArrayKeywordsTest::testTranslation is invalid.
Outline should have examples table, but got none for outline "Erasing other agents' memory" on line: 35 in file: az_1.feature:
["# language: az\n\u00d6z\u0259llik: Internal operations\n  In order to stay secret\n  As a secret organization\n  We need to be able to erase past agents' memory\n\n  Kontekst:\n    Tutaq ki there is agent A\n    Verilir there is agent A\n    H\u0259m there is agent B\n    V\u0259 there is agent B\n\n  N\u00fcmun\u0259l\u0259r: Erasing agent memory\n    Tutaq ki there is agent J\n    Verilir there is agent J\n    H\u0259m there is agent K\n    V\u0259 there is agent K\n    N\u0259 vaxt ki I erase agent K's memory\n    \u018fg\u0259r I erase agent K's memory\n    O halda there should be agent J\n    Ancaq there should not be agent K\n    Amma there should not be agent K\n\n  Ssenari: Erasing agent memory\n    Tutaq ki there is agent J\n    Verilir there is agent J\n    H\u0259m there is agent K\n    V\u0259 there is agent K\n    N\u0259 vaxt ki I erase agent K's memory\n    \u018fg\u0259r I erase agent K's memory\n    O halda there should be agent J\n    Ancaq there should not be agent K\n    Amma there should not be agent K\n\n  Ssenarinin strukturu: Erasing other agents' memory\n    Tutaq ki there is agent <agent1>\n    Verilir there is agent <agent1>\n    H\u0259m there is agent <agent2>\n    V\u0259 there is agent <agent2>\n    N\u0259 vaxt ki I erase agent <agent2>'s memory\n    \u018fg\u0259r I erase agent <agent2>'s memory\n    O halda there should be agent <agent1>\n    Ancaq there should not be agent <agent2>\n    Amma there should not be agent <agent2>\n\n    N\u00fcmun\u0259l\u0259r:\n      | agent1 | agent2 |\n      | D      | M      |"]
WARNINGS!
Tests: 190, Assertions: 562, Warnings: 1.

and only runs 190 tests.

But recently there were 260 tests running - e.g. https://travis-ci.org/Behat/Gherkin/jobs/416234102

PR coming...

Missing asterisk step keywords.

Improve filesystem cache

Sometimes there's an issue with cache, where it isn't updated when it should be or when the cache itself is getting damaged. We need to find a more robust approach with the cache

Retain leading white space in table nodes

Imagine you have an Examples table like this:

Examples:
    | Quantity    | StartAmount | StartUnit | ResultAmount | ResultUnit |
    | Volume      |    1        | l         |    1         | l          |
    | Volume      |  350        | usg       | 1324.8935    | l          |
    | Volume      | 1000        | l         |  264.1722    | usg        |
    | Volume      | 1000        | l         |  219.9692    | bg         |
    | Volume      |   80        | bg        |   96.0760    | usg        |

Parsing and printing that table would print:

| Quantity | StartAmount | StartUnit | ResultAmount | ResultUnit |
| Volume   | 1           | l         | 1            | l          |
| Volume   | 350         | usg       | 1324.8935    | l          |
| Volume   | 1000        | l         | 264.1722     | usg        |
| Volume   | 1000        | l         | 219.9692     | bg         |
| Volume   | 80          | bg        | 96.0760      | usg        |

because leading white spaces aren't remembered after parsing. It'd be so nice to keep them, to print the exact same table as was input.

Obviously it's not very important, but it is nice. And it's possible and backward compatible, but it's not very pretty. I had to alter the Lexer (parse the table and keep left padding) and the TableNode (remove left padding from values, but save their sizes).

I'll create a pull request.

Allow value escaping in TableNode

Hi,

Sometimes, we need the | caracter in a cell of a TableNode, but IIRC, there is no way to do so.

Would great if it could be implemented ! But if it is already possible, I couldn't find how to do so...

Thanks !

New option name filtering: add row number

I have updated the nameFilter to allow searching op specific example

dbollaer@47ae3ba

//syntax is from results junit
--name="Checking defaults search criteria, Ex #3"

//plan to link this to link this, to an other page(status page). So you can run the failed tests only

Could you please apply this.

Role filter in other languages

Hey,

I'm a big fan of the RoleFilter. Now I've started a project with feature files written in German and noticed that the RoleFilter cannot be used in languages other than English.
(How) Can I help to provide support for other languages?

Respecting the EOL of the feature file for PyStringNode

The method getRaw() just join the lines using "\n".

It would be useful if it could detect the EOF of the feature file and use the same.
If you need to produce a string with CRLF, a basic string comparison with the PyStringNode will fail.
public function getRaw() { return implode("\n", $this->strings); }

Snipets from non-english scenarios are generated only with @Given annotation

(Please read this post in a raw version)

Consider Two scenarios:

scenario.en.feature

@bugen
Feature: Behat should generate proper snippets
  In order to have a proper snippets code
  As a developer
  I need Behat to generate propper snippets

  Scenario: Showing the bug
    Given en this should be Given
    When en this should be When
    Then en this should be Then

And scenario.pl.feature:

# language: pl

@bugpl
Potrzeba biznesowa: Feature: Behat should generate proper snippets
  In order to have a proper snippets code
  As a developer
  I need Behat to generate propper snippets

  Scenariusz: Showing the bug
    Mając pl this should be Given
    Jeśli pl this should be When
    Wtedy pl this should be Then

When i run:

bin/behat --tags bugen

I got a proper snippets output:

    /**
     * @Given /^en this should be Given$/
     */
    public function enThisShouldBeGiven()
    {
        throw new PendingException();
    }

    /**
     * @When /^en this should be When$/
     */
    public function enThisShouldBeWhen()
    {
        throw new PendingException();
    }

    /**
     * @Then /^en this should be Then$/
     */
    public function enThisShouldBeThen()
    {
        throw new PendingException();
    }

But when i run:

bin/behat --tags bugpl

All the snippets has @given annotation

    /**
     * @Given /^pl this should be Given$/
     */
    public function plThisShouldBeGiven()
    {
        throw new PendingException();
    }

    /**
     * @Given /^pl this should be When$/
     */
    public function plThisShouldBeWhen()
    {
        throw new PendingException();
    }

    /**
     * @Given /^pl this should be Then$/
     */
    public function plThisShouldBeThen()
    {
        throw new PendingException();
    }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.