The SpecFlow Cook Book

WaitingForSomethingToHappen

Waiting for something to happen

Whats the problem?

you want to test the outcome of a long running process and it makes sense to have some way of expressing how long to waitwhiting your feature files.

The ingredients

  1. A simple regular expression
  2. A timer
  3. Some cool wording in your scenarios

Instructions

Ok, so you have a bit of a monster you need to test. Perhaps it’s a message gateway designed to process millions of inbound messages every hour, or perhaps its a million rows in a database that are being processed. Too boring? Ok maybe it’s some whizzy imaging app that recognises the faces of runners in a marathon, it really doesn’t matter the point is that for systems which take a long time to complete, or maybe never actuall compete at all we need a way of being able to test that those systems are working without having our tests hang for hours.

It’s also possibly worth remembering that the performance of an application is sometimes As important a behaviour as the job that it is designed to perform. So with that in mind we need a decent way of expressing it in our features.

Consider the following :

GIVEN that people email us all day
WHEN an email arrives from an existing customer
THEN a help desk ticket is created to deal with their request

Fairly straight forward, but how do we know when the test has passed (or pit another way, how do we know when it hasnt)?

The most obvious answer is to allow a fixed period of time for the help desk ticket to be created.

 

ime value and unit of measure in regular expression.

Sleep until timeout.

Used if you don’t know how long something will take

close
WaitingForSomethingToHappen

Waiting for something to happen

Leave a Reply

Paul Marshall

I started Wavecrest Software in 1999 and have achieved success in a range of UK blue chip companies as well as small and medium sized businesses. Proven track record in software development from an extensive hands-on technical lead / senior development background using .NET technologies and Agile methodologies.
WaitingForSomethingToHappen

Waiting for something to happen December 16, 2013


Contact


Search