specflow using scenario outline + examples


Specflow scenario outline and example are pretty useful when you have many inputs that you want to test out scenario. For example, a login page, you might have many heaps of user/password combination to try out - maybe to test out different roles, valid / invalid users combination.

So you probably need to create a basic scenario outline with example, as shown here :-



To create those table separator, just type it out using the pipe character and Specflow will automatically parse for you (will also auto generate test cases for you too). Nothing magically about it. 

What my test scenario will do is, fire up chrome and use input provided in the table to login to a system.

Its pretty descriptive of what it is trying to do.



The only catch is you need to create a model and tied it together.



If you take a look at Line #14, this method accepts an object called table. We bind table data into our model called "User" and then we can start filling up our control with data.
Specflow automatically generate 3 different unit test cases for you because you have 3 rows in your table.

That's it. Pretty easy way to test out multiple scenarios.















Comments

Popular posts from this blog

The specified initialization vector (IV) does not match the block size for this algorithm