How to skip certain tests with Test::Unit

Posted by Daniel Abrahamsson on Stack Overflow See other posts from Stack Overflow or by Daniel Abrahamsson
Published on 2010-05-28T07:51:21Z Indexed on 2010/05/30 23:52 UTC
Read the original article Hit count: 166

Filed under:
|
|

In one of my projects I need to collaborate with several backend systems. Some of them somewhat lacks in documentation, and partly therefore I have some test code that interact with some test servers just to see everything works as expected. However, accessing these servers is quite slow, and therefore I do not want to run these tests every time I run my test suite.

My question is how to deal with a situation where you want to skip certain tests. Currently I use an environment variable 'BACKEND_TEST' and a conditional statement which checks if the variable is set for each test I would like to skip. But sometimes I would like to skip all tests in a test file without having to add an extra row to the beginning of each test.

The tests which have to interact with the test servers are not many, as I use flexmock in other situations. However, you can't mock yourself away from reality.

As you can see from this question's title, I'm using Test::Unit. Additionally, if it makes any difference, the project is a Rails project.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby