2

Does anyone know away of ignoring selected tests when the network is unavailable. Something like a conditional Ignore attribute?

kaya3
  • 47,440
  • 4
  • 68
  • 97
jflood.net
  • 2,446
  • 2
  • 21
  • 19

1 Answers1

2

I don't know about ignoring certain tests at runtime. However, you could two things I can think of. The first is at the start of the test you could check if the network is available and if not just return which would mark the test as passed. Or, you could check for the network in an Assert Inconclusive which would mark the test inconclusive in the results.

Alex
  • 12,749
  • 3
  • 31
  • 45
  • Thanks alex, I suspected this too. The reason I ask is I've written an attribute for this, but wanted to know if I was wasting my time. http://jflood.net/2012/05/11/integration-tests-tests-fail-when-network-unavailable/ – jflood.net May 12 '12 at 01:20
  • It works as Alex mentioned. Check your condition first (in this case network connectivity) and then do Assert.Inconclusive(); +1 – activebiz Dec 04 '13 at 12:49