cucumber-rs / gherkin Goto Github PK
View Code? Open in Web Editor NEWPure Rust implementation of Gherkin language (`.feature` file) for Cucumber testing framework.
License: Apache License 2.0
Pure Rust implementation of Gherkin language (`.feature` file) for Cucumber testing framework.
License: Apache License 2.0
This issue tracks the status of Gherkin-Rust implementation in terms of the specifications and data used in the upstream project.
The purpose of this issue is to track status. Please open a new issue if you wish to record or discuss a particular feature or its implementation.
Each item should be checked off once the specification and data and exactly match. NA items should be checked off once there is a spec/test confirming that no output is produced.
Any partial matches should be noted but not checked off.
In order to determine a match or not we rely on the Cucumber Compatibility Kit (CCK). The CCK allows certain fields to be different from the golden master, such as: SourceReference
fields used in support code messages, Duration
and Timestamp
fields id
fields.
To update the status of Cucumber-Rust compared to golden-master:
>15.0
or from NodeSourcenpm
git clone https://github.com/cucumber/cucumber ~/src/cucumber
git clone https://github.com/bbqsrc/gherkin-rust ~/src/cucumber-rust
pushd ~/src/cucumber/fake-cucumber
npm install -g fake-cucumber
popd
pushd ~/src/cucumber/compatibility-kit
make clean
make
popd
The specifications and data in Gherkin-Rust are circa 27-Feb 2021, commit 109f9a3.
Please open a pull request if you notice any specification or data has changed and uncheck the relevant item(s) in this list:.
Currently gherkin::Step
may have both Table
and DocString
- it works pretty well, but turns out it's unfortunately disallowed by gherkin
spec: cucumber/docs#970
This issue tracks the status of Gherkin-Rust implementation in terms of the specifications and data used in the upstream project.
The purpose of this issue is to track status. Please open a new issue if you wish to record or discuss a feature and its implementation.
Each item should be checked off once the specification and data and exactly match. NA items should be checked off once there is a spec/test confirming that no output is produced.
Any partial matches should be noted but not checked off.
In order to determine a match or not we rely on the Cucumber Compatibility Kit (CCK). The CCK allows certain fields to be different from the golden master, such as: SourceReference
fields used in support code messages, Duration
and Timestamp
fields id
fields.
The specifications and data in Gherkin-Rust are circa 27-Feb 2021, commit 109f9a3.
Please open a pull request if you notice any specification or data has changed.
Cucumber Messages is a message protocol for representing results and other information from Cucumber - Replaces json
and junit
formatters.
Stability/Performance:
With Cucumber Messages, several messages containing smaller pieces of information are emitted continuously to a stream,
avoiding high memory consumption and enabling real-time processing of results.
Additional functionality (motivation):
The protocol aims to decouple various components of the Cucumber platform so that:
- Each component only needs to know about a subset of messages
- Gherkin is decoupled from the Cucumber execution component
- This is part of a strategy to support other formats such as Markdown and Excel
Hi,
I'm trying to use background
keyword to for repeated authentication steps (after feature
tag, or after the rule
tag), but it always gives me an error:
Feature: As a REST API consumer
I want to retrieve data matching to the ID code
I supply So I can use this data, for example, to create a report
Background: Authentication steps
Given I am authenticated
And I have a role which allows reading the data
Rule: I am authenticated
Scenario: An existing ID code yields the correct data
Given the ID code FOO
When I request the data corresponding to the ID code
Then the response in a JSON format contains the data
$ cargo test --test cucumber
warning: unused import: `steps`
--> tests/cucumber.rs:4:26
|
4 | use cucumber::{cucumber, steps, before, after};
| ^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: 1 warning emitted
Finished test [unoptimized + debuginfo] target(s) in 0.10s
Running target/debug/deps/cucumber-b90ec94496d41947
[Cucumber v0.6.9]
———— ! Parsing feature failed: —————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— features/example.feature:5:2
--> 5:2
|
5 | Background: Authentication steps␊
| ^---
|
= expected EOI or tag
———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
0 features (1 errored)
0 scenarios (0 passed)
0 steps (0 passed)
error: test failed, to rerun pass '--test cucumber'
Feature: As a REST API consumer
I want to retrieve data matching to the ID code
I supply So I can use this data, for example, to create a report
Rule: I am authenticated
Background: Authentication steps
Given I am authenticated
And I have a role which allows reading the data
Scenario: An existing ID code yields the correct data
Given the ID code FOO
When I request the data corresponding to the ID code
Then the response in a JSON format contains the data
$ cargo test --test cucumber
warning: unused import: `steps`
--> tests/cucumber.rs:4:26
|
4 | use cucumber::{cucumber, steps, before, after};
| ^^^^^
|
= note: `#[warn(unused_imports)]` on by default
warning: 1 warning emitted
Finished test [unoptimized + debuginfo] target(s) in 0.10s
Running target/debug/deps/cucumber-b90ec94496d41947
[Cucumber v0.6.9]
———— ! Parsing feature failed: —————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— features/example.feature:6:3
--> 6:3
|
6 | Background: Authentication steps␊
| ^---
|
= expected EOI or tag
———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
0 features (1 errored)
0 scenarios (0 passed)
0 steps (0 passed)
error: test failed, to rerun pass '--test cucumber'
Am I doing something in a wrong way, or background
usage is not supported yet?
Fresh checkout of master, trying to run the tests - one of the smokes is failing:
PS F:\work\RustProjects\gherkin-rust> cargo test
Finished test [unoptimized + debuginfo] target(s) in 0.16s
Running target\debug\deps\gherkin_rust-9b6b434a8d9b6c63.exe
running 12 tests
test tagexpr::tests::parse_tag_expr1 ... ok
test tagexpr::tests::parse_tag_expr3 ... ok
test tagexpr::tests::parse_tag_expr1b ... ok
test tagexpr::tests::parse_tag_expr2 ... ok
test tagexpr::tests::parse_tag_expr4 ... ok
test tagexpr::tests::parse_tag_expr2b ... ok
test tagexpr::tests::parse_tag_expr5 ... ok
test tagexpr::tests::parse_tag_expr6 ... ok
test tagexpr::tests::parse_tag_expr7 ... ok
test parser::test::smoke2 ... FAILED
test parser::test::smoke ... ok
test tagexpr::tests::parse_tag_expr8 ... ok
failures:
---- parser::test::smoke2 stdout ----
thread 'parser::test::smoke2' panicked at 'assertion failed: gherkin_parser::feature(&s, &env).is_ok()', src\parser.rs:515:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failures:
parser::test::smoke2
test result: FAILED. 11 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
Hi,
I could use some help figuring out this problem.
We have a few .feature files details simple test cases, instead of using cucumber, I'm using this crate directly so that I could implement the tests as a unit test, so that code coverage tools would give me a coverage report.
Here is the test code: https://github.com/apollographql/rust/blob/63c62f5a29c328e429d463b958a2bbb832b09b89/query-planner/src/lib.rs#L70-L114
This code only fails on windows. That if cfg!(windows) {
line was an attempt to resolve the issue, but it didn't matter.
See this test run: https://github.com/apollographql/rust/runs/1028873036?check_suite_focus=true
You can navigate to other runs of the same branch as well.
The error message is unclear as well:
error at 6:12: expected hacks
The only place in this codebase that has the word "hacks" is here, unfortunately, that's too deep in a macro for me to understand what it's supposed to mean.
I noticed that if I remove the if cfg!(windows)
condition and always replace \n
with \r\n
, then I get the same error message on my mac.
Any help would be appreciated, thanks!
I've just randomly noticed that having a data table - or, at least, an examples table but I assume it's the same - at the end of the file and not having a newline afterwards means the feature file doesn't parse.
For example:
Scenario Outline: Look up an unknown username: <Username>
When I look up the username '<Username>'
Then the username does not exist
Examples:
| Username |
| unknown |
If there's a newline at the end, that all works fine. If there's not then I get:
———— ! Parsing feature failed: ————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— tests/features/users/lookup_username.feature:10:25
--> 10:25
|
10 | | unknown |
| ^---
|
= expected table_field or table_row
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
It's a really easy fix in the feature file, but it wasn't obvious what was wrong or why.
One of the primary benefits of BDD is that it produces living documentation. This can be particularly effective when the gherkin is post-processed by something like AsciiDoctor to provide URLs, images, mathematical notation, etc in a convenient, easy to read and useful document.
However, unlike other parsers this one appears to crash if the descriptions for Features/Scenarios are more than one line long or have any whitespace
Steps to reproduce-> Use the following Gherkin
Feature: Living Documentation
Living documentation is used by may companies, including those with mission critical objectives such as healthcare. In these cases, the documentation is the source of truth and is central to the businesses operations.
Not being able to document or provide mark up or other useful features limits the viability of what is supposed to be a source of truth.
Scenario: Adequate Description for core operations.
We definitely want to be able to do this.
Given I am writing living documentation
And many levels of management, coworkers and others rely on it
Then I need to have lengthier descriptions for features and scenarios
Given the following scenario:
Scenario Outline: Look up a known username: <Username>
Given a user exists with details:
| Username | <Username> |
When I look up the username '<Username>'
Then the username does exist
Examples:
| Username |
| known |
The insert <Username>
from the Examples table works correctly in the Scenario name and in the "When" step, but not in the "Given" step. Instead, when parsing the table, I get:
[["Username", "<Username>"]]
Where I would have expected:
[["Username", "known"]]
https://github.com/cucumber/cucumber/tree/master/datatable has examples with empty table headers.
Once upstream resolve issue #1400:
compatibility-kit
Error during parsing in case there is a comment and a tag on the feature:
#comment
@tag
Feature: feature
It works with comment only:
#comment
Feature: feature
It also works with tag only:
@tag
Feature: feature
Hi,
when I use tabs as an indentation in feature file, then file is not parsed correctly - feature
is found but no scenario
and its steps are found (<tab>
is a tab character):
Feature: Example feature
<tab>Scenario: An example scenario
<tab><tab>Given I am trying out Cucumber
<tab><tab>When I consider what I am doing
<tab><tab>Then I am interested in ATDD
<tab><tab>And we can implement rules with regex
$ cargo test --test cucumber
Finished test [unoptimized + debuginfo] target(s) in 0.11s
Running target/debug/deps/cucumber-8962c0abc6f239cb
[Cucumber v0.7.0]
Feature: Example feature features/example.feature:1:1
[Summary]
1 features
0 scenarios (0 passed)
0 steps (0 passed)
Finished in 0.0 seconds.
when I convert tabs to spaces then everything is working:
$ cargo test --test cucumber
Finished test [unoptimized + debuginfo] target(s) in 0.11s
Running target/debug/deps/cucumber-8962c0abc6f239cb
[Cucumber v0.7.0]
Feature: Example feature features/example.feature:1:1
Scenario: An example scenario features/example.feature:3:3
✔ Given I am trying out Cucumber features/example.feature:4:5
✔ When I consider what I am doing features/example.feature:5:5
✔ Then I am interested in ATDD features/example.feature:6:5
✔ And we can implement rules with regex features/example.feature:0:167
[Summary]
1 features
1 scenarios (1 passed)
4 steps (4 passed)
Finished in 0.1 seconds.
I'm using latest cucumber-rust 0.7.0 with gherkin-rust 0.8.1
A failing test has been committed.
Parsing the following feature fails with a parsing error like expected:
Feature: Example feature
Scenario: Just some example scenario
Given there is a table with some rows
| 1 | 1 |
| 1 |
With such a parsing error output:
1 parsing error
gherkin crate parsing error is: "inconsistent table row sizes"
However, the following feature is parsed without any issues and the last column of the last row omitting silently:
Feature: Example feature
Scenario: Just some example scenario
Given there is a table with some rows
| 1 |
| 1 | 1 |
In case the step is defined the output is like this:
Feature: Example feature
Scenario: Just some example scenario
✔ Given there is a table with some rows
| 1 |
| 1 |
[Summary]
1 feature
1 scenario (1 passed)
1 step (1 passed)
I would have expected the second example feature to also fail and especially not omit a part of the table silently.
This was observed with the following crate versions:
cucumber = "0.20.1"
gherkin = "0.14.0"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.