My project has some unit tests. They all depend on some external service, over which I have no control. This service is frequently down (recall Twitter circa 2008). Currently, if the service is down, then the tests fail, and the continuous integration server won't build. I resent this. I'd like to ignore the tests that depend on this setup, printing a warning.
[BeforeScenario]
try
{
connect(server)
}
catch (Exception x)
{
throw new Exception(String.Format("Failed to connect to server {0}", server), x);
}
How can I do this? I happen to be using SpecFlow today, but I'd also like to know how to do this from NUnit.
Below is what I have currently. It's okay. The tests are ignored, but the build still fails.
[BeforeScenario]
try
{
connect(server)
}
catch (Exception x)
{
throw new SpecFlowCancelTests(String.Format("Failed to connect to server {0}", server), x);
}