1
votes

I am using SpecFlow for my test and looking for a way to using inupt data from excel/csv/json in my feature file. I am treed to use SpecFlow+ Excel but it's not compatible with .NETCore and SpecFlow 3.3.57 which I am using. I also tried to use Itamaram.Excel.SpecFlowPlugin but it also didn't work. https://github.com/Itamaram/SpecFlow.Plugin.Base Is it any way to read input data from external file and write it to my feature file?

1
The excel package is using OfficeOpenXml which is support in core : nuget.org/packages/OfficeOpenXml.Core.ExcelPackage - jdweng
What is your usecase @MichalG? Why do you want to do it? Feature request to update SpecFlow+ Excel to upvote is here: support.specflow.org/hc/en-us/community/posts/… - Andreas Willich
@AndreasWillich I need to write test for big amount of data which is stored in excel files and update really often - MichalG

1 Answers

1
votes

We have a new plugin to get external data from json files.

It is a simple SpecFlow plugin that you can install as a NuGet package.

Example of usage:

@property:email=E-mail_addresses.Valid
Scenario Outline: recording user information on successful registration

Given a visitor registering as "Mike Scott" with email <email>
When the registration completes
Then the account system should record <email> related to user "Mike Scott"

Examples: key examples
  | Variant            | email              |
  | simple valid email | [email protected] |

The json file looks like this:

{ 
  "E-mail addresses": {
    "Valid" :{
      "Simple": "[email protected]",
      "Dot in the address": "[email protected]"
    }
  }
}

More details are in the blog post about it: https://specflow.org/blog/new-plugin-externaldata-helps-you-improve-test-coverage-quickly/


Full disclosure: I am the community manager of SpecFlow and SpecFlow+