Data Driven testing using data from json file
We use examples or datatables in specflow feature file to give different inputs to scenarios. Is it possible to receive the inputs from JSON file instead of mentioning it in the feature file. Meaning, is it possible to supply inputs to a scenario from external JSON file instead of supplying it from examples?
This is a sample feature file with inputs to scenario supplied from Examples:
Scenario Outline: Add two numbers
Given the first number is <Value1>
And the second number is <Value2>
When the two numbers are added
Then the result should be <Expected result>
Examples:
| Value1 | Value2 | Expected result |
| 2 | 3 | 5 |
| 2 | 5 | 7 |
Instead of giving the inputs in Examples, can we give it in an external JSON file like below? If yes, how? Kindly help.
[
{
"Value1": 2,
"Value2": 3,
"Expected result": 5
},
{
"Value1": 2,
"Value2": 5,
"Expected result": 7
}
]
1
-
Can I please have any info on this?
1 -
Have you got solution
0
Please sign in to leave a comment.
Comments
2 comments