Wednesday, November 3, 2010

@ignore SpecFlow scenario

When you have all SpecFlow scenarios working, you always run them.
However, sometimes tests are incomplete or just broken. The correct course of actions is to fix or complete tests, but often you just don't have time (yeah, you need to deliver the product next day, but it will take two days to fix the test). In this case you may use a predefined tag, @ignore with SpecFlow scenarios. Adding this tag to a scenario will mark this test is ignored. That will allow you to pass tests without having ignored tests

For instance, you have a scenario which doesn't work yet

Scenario: Create User
Given ....

Running it as is causes a test (and the whole test suite) to fail

So once you modify as below

Scenario: Create User
Given ....

You have your tests passed (or, more precisely, not failed).

P.S. Ignoring an issue is just a way to postpone its resolution, you'd need to fix to this scenario anyway. However, if this scenario isn't needed, just delete it.