Filtering by Examples using specflow

62 views
Skip to first unread message

Sudhindra G

unread,
Jul 10, 2020, 3:06:49 AM7/10/20
to SpecFlow
Hi Team -

We have a requirement where we want to filter our Examples table data & run tests only specific to the test environment e.g.,

Scenario Outline: 1. Navigate to home page
       
Given I login
       
When i search with ClientId
       
Then i am taken to page specific to ClientId

 
Examples:
 
|environment| ClientId         |
 
|qa| 123 |
 
|prod| 777    |

Lets say i want to execute the above test only with ClientId 123 when i run test in qa environment = ''qa". How can i achieve it in Specflow. Any help would be highly appreciated.

praveenreddy narala

unread,
Jul 10, 2020, 3:13:54 AM7/10/20
to spec...@googlegroups.com
Hi,

Directly you can not filter environment from examples. Instead u could use tags. 

Other approach would be read data from examples via steps and handle them in bindings by reading target environment from test settings or srprofile in conditional statements.

Thank you.

Regards 
Praveen 

--
You received this message because you are subscribed to the Google Groups "SpecFlow" group.
To unsubscribe from this group and stop receiving emails from it, send an email to specflow+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/specflow/2af5f993-c262-4404-8a7e-48db24ed110ao%40googlegroups.com.

Sudhindra

unread,
Jul 10, 2020, 3:30:19 AM7/10/20
to spec...@googlegroups.com
Hi Praveen -

Thanks for your response. Can you please share an example how we can filter using tags ?

Cheers,
Sudhindra..


praveenreddy narala

unread,
Jul 10, 2020, 5:35:51 AM7/10/20
to spec...@googlegroups.com
Hi,

In .srprofile we have an option called Filters. 
<Filter>QA</Filtet>

Regards,
Praveen 

Sudhindra

unread,
Jul 10, 2020, 8:35:30 AM7/10/20
to spec...@googlegroups.com
Hi praveen - 

If i plan to use filters then i need to duplicate my feature files and add tags for every test environment.

Cheers,
Sudhindra..


Sudhindra G

unread,
Jul 13, 2020, 6:52:54 AM7/13/20
to SpecFlow
Reply all
Reply to author
Forward
0 new messages