I am not sure this is a "test".
This is definitely a script that captures data, but tests also have a condition, value, or state in them that needs to be checked.
So, I would expect to see something more like
Given I set something up And I setup something else .... When I run the program Then my startup time should be less than 1 second
However, I understand your desire for a simple, consistent way to run this test, and although I believe that SpecFlow may not be the best way to achieve what you want, you can consider the granularity of your tests. For example, you can rewrite your script as
Given I ... When I run the program Then my startup time should be less than 1 second When I run the program Then my startup time should be less than 1 second When I run the program Then my startup time should be less than 1 second
And now you checked three times.
Or you could write it like
Given I ... When I run the program 3 times Then my startup time should be less than 1 second
and then in your c #
[When("I run the program (\d+) times")] public void WhenIRunTheProgramManyTimes(int count) { for(int i=0; i++; i<count) WhenIRunTheProgram(); } [When("I run the program")] public void WhenIRunTheProgram() { ....
Also look at Dan North. Whose domain is it anyway? , this can help you structure your future scenarios. :-)
Alski source share