-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
Question: How to do data-driven testing with Excel? #245
Comments
Hi @TomasRibeiro96 Similar approach exists in Specflow, it loads |
Hi @vitalets, here's an example of a feature file:
The Excel file would contain a table such as: The intention is to execute the test from the feature file but use the test data from the Excel file. Hence, in this situation, from 1 feature file there should be 3 tests executed, each test for each row in the Excel file. Any suggestions about how to implement this? |
So the goal is to load examples data from external xls file. I've found this SO question with the same request. One of suggestions is to use preprocessing: treat feature file as a template and generate 3 actual feature files. I'd suggest to follow it for now, as it's straightforward and keeps excel parsing on your side. Btw, why are you against pre-script? Another approach we can think for the future - to link external data source inside feature file. To not break gherkin syntax we can put file path to Examples name: Scenario Outline: my scenario
Given I login as "XXX"
When I create a case
And I fill the field "Name" with "<Name>"
And I fill the field "ID" with "<ID>"
Then the text "<ExpectedText>" appears on the page
Examples: path/to/examples.xls |
Another approach used in Gauge library: there is parameter prefix to get value from a csv file: https://docs.gauge.org/writing-specifications?os=macos&language=javascript&ide=vscode#special-parameter-csv Can be considered as well. |
Hello,
Thank you for this package. We are currently using it in our projects but a new need arose. We want to do data-driven testing and execute the same test with different test data. However, and here's the catch, the Test Data must come from an Excel file that other people can edit to change what's being tested. Hence, the generated "*.feature.spec.js" files must be dynamic.
The Examples functionality could be useful, however the test data needs to come from the Excel file and can't be static in the feature file. I want to avoid other people updating the feature files because that would imply that they need to have VS Code and do a commit and push. It's easier for them to just change an Excel file in Jira.
Additionally, I wanted to avoid having to run a pre-script separately to generate tests. I was looking for a solution that integrates with a simple
npx bddgen && npx playwright test
and avoids bigger changes do the pipeline.Given this, do you have any suggestion about how to address this situation?
Thank you.
The text was updated successfully, but these errors were encountered: