SpecFlow+ Excel: How to target specific Example Table rows?

103 views
Skip to first unread message

James Massa

unread,
Feb 13, 2019, 11:40:43 AM2/13/19
to SpecRun
Our use case is that we have multiple environments that need to run the same test cases, but the data in those environments are unique to the environment we are running against. We don't want to duplicate the exact same test case just because the data is different between the environments, so we were hoping to us SpecFlow+ Excel to have a single Example table where each environment's Example data is on a specific row.

So we would have a table like such as an Excel file:
Environment | X | Y | Result
Env1 | 0 | 0 | 0
Env2 | 0 | 1 | 1

... and have a Scenario such as this:
Scenario Outline: Simple Example
	Given I have entered <X> 
	And I have entered <Y> 
	Then the result should be <Result >
@source:Examples.xlsx
Examples:
	| Environment | X | Y | Result |


How would I target a specific Row of the Excel file based on the Environment row value?

Andreas Willich

unread,
Feb 14, 2019, 7:01:33 AM2/14/19
to spe...@googlegroups.com
Hi James

It depends on the test runner you are using to execute the scenarios. As you are using SpecFlow+Excel, I assume you are also using the SpecFlow+Runner.
Filtering the scenarios on an example level is not yet possible. It's on our backlog to add this feature.

I don't know your exact use case, but did you already looked in the Targets- Feature of the SpecFlow+Runner. This is made to execute the same scenario with different configurations.
We have an example here (https://github.com/techtalk/SpecFlow.Plus.Examples/tree/master/SeleniumWebTest) to test the same application with different browsers.


You can filter on targets, because the target name will be part of the scenario name.

Best regards
Andreas


--
You received this message because you are subscribed to the Google Groups "SpecRun" group.
To unsubscribe from this group and stop receiving emails from it, send an email to specrun+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

James Massa

unread,
Feb 14, 2019, 12:08:33 PM2/14/19
to SpecRun
We don't wish to filter the scenario, we just want to use the same scenario on multiple environments that don't share a common database. So the input and expected results in each environment differ, but the method in which that data is entered and obtained is identical. Our only option atm is to have a different excel file version for each environment, but this leads to mistakes of which version of file goes where. If we were able to place the data in a single excel file and select which row it would eliminate a lot of redundancy and greatly reduce the chance of human error during checkin.

Annie Costa

unread,
Mar 10, 2020, 5:37:41 AM3/10/20
to SpecRun
Hi Andreas,

I see in your comment that the filtering the scenario on an example level is on your Backlog.
Do you have any news on when it will be delivered?

Thanks
Annie
To unsubscribe from this group and stop receiving emails from it, send an email to spe...@googlegroups.com.

Annie Costa

unread,
Sep 4, 2020, 4:32:51 AM9/4/20
to SpecRun
Hi  Andreas,

Is there any news about the launch of a scenario example in command line?

thanks
 Annie

Andreas Willich

unread,
Sep 8, 2020, 3:52:25 AM9/8/20
to SpecRun
No, sadly not.

To unsubscribe from this group and stop receiving emails from it, send an email to specrun+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/specrun/eb0a417f-2f16-4958-8dba-7d6b277e66f0n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages