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 load multiple feature file or execute group of features #40

Closed
UsharaniA opened this issue Dec 4, 2018 · 8 comments
Closed

How to load multiple feature file or execute group of features #40

UsharaniA opened this issue Dec 4, 2018 · 8 comments

Comments

@UsharaniA
Copy link

Hi,
I want to execute group of features files through jest cucumber package and i see currently it allows only one feature to be loaded.

const feature=loadfeature('**/firstfeature.feature')

@bencompton
Copy link
Owner

Yes, each call to loadFeature will load one feature file. Typically, you will have one step definition file per feature file and call loadFeature in each step definition file. Did you have another use case in mind?

@UsharaniA
Copy link
Author

Ok,
I have few test cases which have same definition and i don't want to repeat the feature file creation and step definition creation for each so if i though if i have step definition i can create multiple feature and invoke them for all

@UsharaniA
Copy link
Author

UsharaniA commented Dec 5, 2018

Also i have a issue ,below is my defibition

when(/^the user loginto ART with credential from "([^"])" and "([^"])" column from spreadsheet$/, () => {
return queryRedshift.dbValidate();

});

when(/^the user selects client as value from "([^"]*)" column and account structure from "([^"]*)" column and datarange from "([^"]*)" column and View as Paid$/, (pclient,paccountStructureName, pdateRange, pviewSelect) => {
 
   console.log("The user selects account structure");
});

then(/^the user read date and funding arrangement from ART screen and store in Config file$/,() =>{
   console.log("The user selects account structure");
});

i can see before the first when is complete the test is moving to other When and then , how can i fix them and my requirement is to run them synchronously.

@bencompton
Copy link
Owner

So is queryRedshift.dbValidate() returning a promise? If so, it should not be moving to the next steps until that promise resolves. If there is a more complex promise chain going on inside of that call, then are you sure that the promise isn't resolving before you expect?

@bencompton
Copy link
Owner

As for avoiding repeating step definitions, it might help if you extract your step definitions into re-usable functions.

@UsharaniA
Copy link
Author

Thanks i fixed my promise issue and now it works.

@UsharaniA
Copy link
Author

UsharaniA commented Dec 7, 2018

I see "jest-html-reporter": "^2.4.2" produces html reports of the pass fail steps but it gives the details of only the test annotation and not the Given,When, then closed under test annotation,please let me know if am missing anything and also let me know if i can attach screenshot and test steps .
image

My feature file:
Scenario:ValidateTrendAmbulatoryCondition
Given the testcase is "ValidateTrendAmbulatoryCondition"
When the user loginto ART with credential from "pUserName" and "pPassword" column from spreadsheet
When the user selects client as value from "pClient" column and account structure from "pAccountTitle" column and datarange from "pDateRange" column and View as Paid
When the user read date and funding arrangement from ART screen and store in Config file
When the user navigate to Dashboard Pathway and select dashboard as from "pDashboardName" column
Then use the dashboard object "ambulatorycondition" from repository and edit the dashboard in Visualizer and render the Data from BIRST
When the user loginto to Redshift
Then user fires Query and retrive data from Redshift and store it in Excel and compare the data

But i dont see all this details in the html report.

My package.json:
"jestJsonReporter": {
"outputFile": "./report/results.json"
},
"jest-html-reporter": {
"pageTitle": "Your test suite",
"outputPath": "test-report.html",
"includeFailureMsg": true
},

@bencompton
Copy link
Owner

Glad it worked for you! As for reporting, existing Jest reports don't show step info, since that's unique to jest-cucumber and not a general Jest feature. A specialized reporting plug-in is planned. See #17 and #27.

Sounds like your issue is good to go, so I'm going to close this issue.

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

2 participants