Specflow+Excel
- SpecFlow+ Excel is a SpecFlow plugin that allows you to define requirements and example sets in Excel files. These requirements can be used in a same way as normal plain text Gherkin feature files.
- There are two ways to use the Excel files to extend your specifications:
- Define an entire feature file in Excel using the worksheets as scenarios
-
Extend scenario outline examples in normal plain text feature files with Excel tablesHere is the scenario we are going to create (Note: Source tag @Source)
Which way to use the Excel files is better ?
Define an entire feature file in Excel using the worksheets as scenarios or
have scenario outline examples in normal plain text feature files and store examples in Excel tables?
I think defining in normal plan feature file is better compared to excel, since the whole intention of scenarios is to ensure all the business data is readable for feature file itself.
Thanks,
Karthik KK
Can you please help me to get if this is possible?
I created a Directory(Feature) which contains my Feature Files as below:-
Feature: AdditionFeature
In order to avoid silly mistakes
As a math idiot
I want to be told the sum of two numbers
@Add
Scenario Outline: Adding two numbers
Given I have entered into the calculator
And I have also entered into the calculator
When I press add
Then the result should be on the screen
@Source:data.xlsx
Examples:
|a|b|result|
—————————————————————————————
Created a directory(StepDefinition) which contains the step definition
—————————————————————————————
and a directory(File) which contains a .xlsx, after installing SpecFlow.Plus.Excel i want to read from this file, but getting error while execution
Now, If I Put this .xlsx file in the same directory, it works fine
But i want this .xlsx file in different directory and read from there.
Hi Thanks for the video and it is very good. I tried but it is throwing error when i tries to give like
Scenario Outline: Add two numbers
Given I have entered into the calculator
And I have enter into the calculator
When I press add
Then the result should be on the screen
@source:Calculator.xlsx
Examples:
| num1 | num2 | result |
Error Custom tool error: Generation error: Missing [assembly:GeneratorPlugin] attribute in C:\Users\RaviKiran Reddy\source\repos\ExcelSpecFull\packages\SpecFlow.Plus.Excel.2-3-0.1.7.0\tools\SpecFlow.Plus.Excel.SpecFlowPlugin.dll
but when i run like below it is running and gives me output of both excel data and examples data also.
Scenario Outline: Add two numbers
Given I have entered into the calculator
And I have enter into the calculator
When I press add
Then the result should be on the screen
@source:Calculator.xlsx
Examples:
| num1 | num2 | result |
| 5 | 4 | 1 |
Can you please help me out
Hi Karthik Thanks for the video which is very helpful. I have tried as you mentioned above. But I got error like #error (4:1): Scenario Outline ‘Add two numbers’ has no examples defined.
My feature file is like below:
Feature: ReadDataFromExcel
@mytag
Scenario Outline: Add two numbers
Given I have entered into the calculator
And I have entered into the calculator
When I press add
Then the result should be on the screen
@source:data.xlsx
Examples:
| num1 | num2 | result |
Can you please help me on this.
May I know what ever you are getting?
Hi Karthik Thanks For The Video Which Is Very Helpful. I Have Tried As You Mentioned Above. But I Got Error Like #Error (4:1): Scenario Outline ‘Add Two Numbers’ Has No Examples Defined.
My Feature File Is Like Below:
Feature: ReadDataFromExcel
@Mytag
Scenario Outline: Add Two Numbers
Given I Have Entered Into The Calculator
And I Have Entered Into The Calculator
When I Press Add
Then The Result Should Be On The Screen
@Source:data.Xlsx
Examples:
| Num1 | Num2 | Result |
Even I get this error. Can you please help?
Hi Karthik,
I am getting error saying ‘No examples defined’ . Please help me!! Thanks in advance.
Not sure if anyone have seen this error but i am getting below error. Any help would be appreciated. Thank you.
Error (3:1): Scenario Outline ‘Add two numbers’ has no examples defined SpecFlowProject C:\Users\kchennap\Learning\SpecFlow\SpecFlowProject\Features\Calculator.feature 3
Below is the Code:
________________________________
Feature: Calculator
Scenario Outline: Add two numbers
Given the first number is ”
And the second number is ”
When the two numbers are added
Then the result should be 120
@Source:data.xlsx
Examples:
|p0|p1|