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

How to run specific cucumber files or tags now? #24

Closed
rgeraldporter opened this issue Sep 19, 2018 · 8 comments
Closed

How to run specific cucumber files or tags now? #24

rgeraldporter opened this issue Sep 19, 2018 · 8 comments

Comments

@rgeraldporter
Copy link

Hi! I'm cutting over our tests from nightwatch-cucumber to nightwatch-api, but can't seem to find how you can possibly run tests for specific tags or feature files via the CLI.

start-server-and-test doesn't support passing arguments at all, so outside of writing a script entry for every single feature file & tag we have, I don't see how to get this to work in the new setup. In nightwatch-cucumber it was very easy to do.

Expected Behavior

assuming you have something like:

"test": "start-server-and-test test:setup http-get://localhost:4444/status test:run",

Running
npm run test -- features/something.feature

or

npm run test -- -t @my-tag

Current Behavior

Error: expect: <start script name> <url> <test script name>

(throws errors from start-server-and-test as it doesn't accept any more arguments, let alone passing them along)

Possible Solution

Not sure. start-server-and-test has an open issue about this.

Context

(see above)

But also, when developing tests its fairly typical to only run the feature files you're actually developing, right now outside of writing a custom script line I don't see how to do it.

Your Environment

Node 10.10.0, MacOS 10.13.6, used example linked from nightwatch-cucumber for updating the deprecated module.

@mucsi96
Copy link
Owner

mucsi96 commented Sep 24, 2018

In development I suggest to run test:setup and test:run in separate terminals. With that you can achive tow things.

  • No server and webdriver restarts with test reexecution
  • You can provide addition command line options for Cucumber using npm run test:run -- -some-options.
  • Using Cucumber CLI options you can run specific feature files or using expressions you can run specific tags

As I have time will describe this somewhere in the migration docs.

@spnraju
Copy link
Collaborator

spnraju commented Nov 20, 2018

@mucsi96 , is there a way we could pass the environment as well through CLI options instead of passing it in server.js and setup.js files of cucumber examples?

@spnraju
Copy link
Collaborator

spnraju commented Dec 11, 2018

@spnraju spnraju closed this as completed Dec 11, 2018
@gnaneswarreddy
Copy link

Hi @spnraju

With nightwatch api i am not able to run a specific feature file, i have also tried the cucumber CLI option but i am not able to run using nightwatch-api
I tried cucumber-setup.js features/google.feature command

@spnraju
Copy link
Collaborator

spnraju commented Apr 6, 2019

It should be cucumber-js features/google-search.feature.

@mucsi96
Copy link
Owner

mucsi96 commented Apr 6, 2019

I will add this to cucumber docs

@mucsi96
Copy link
Owner

mucsi96 commented Apr 12, 2019

Documentation is updated with filtering feature files and tags

@neillindberg
Copy link

From running with the "--help" flag I can see there is a "--tags" option, but it doesn't work with using @SomeTag, or pointing to a feature file location. Should the flag be removed? I @spnraju 's answer worked for me, but it wasn't apparent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants