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 individual feature in nightwatch js ? #406

Open
veenadamo opened this issue Aug 7, 2018 · 3 comments
Open

How to run individual feature in nightwatch js ? #406

veenadamo opened this issue Aug 7, 2018 · 3 comments

Comments

@veenadamo
Copy link

veenadamo commented Aug 7, 2018

I am new to nightwatch js , currently I an trying to test multiple use cases using nightwatch js, I have followed standard directory structure.

I have usecase1.feature and usecase2.feature files in my features folder and usecase1.js and usecase2.js files in my step_definitions folder.

my package.json file is shown below:

{
"scripts" : {
"usecase1" : "nightwatch",
"usecase2" : nightwatch"
}
}

If I tried to run only usecase1 using command : 'npm run usecase1' but this is executing both usecase1 and usecase2 , My Intention is to run each individual use case separately. Can someone please help me with this.

@mucsi96
Copy link
Owner

mucsi96 commented Aug 12, 2018

You can run a single feature file with
nightwatch usecase1.feature

@veenadamo
Copy link
Author

Thanks Igor , But this fails if there is, say a step which is common in both of my features for ex: both usecase1.feature and usecase2.feature have a step "validate order id" , in this case when I run only usecase1.feature the scenario fails with error : 'Multiple step definitions match'. In this case I have to make sure nothing is common in both my use cases , is there a way I can overcome this ?

@satheesh6789
Copy link

@veenadamo cucumber always scans your step-definition directory. so there should be only step-definition. if your feature file has same step there should be only one implementation
1.either make the step definition unique for usecase1 and usecase2 feature
2.remove and keep only one step definition

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

3 participants