Optimizing testing

M

Martin Martinos

I have a rake task that lunches all my unit tests. The execution of
those tests may take over 20 mins. I would like to have two rake task,
one that executes a set of quick tests and one that executes all the
tests that will be executed in a nightly build.


For the moment I create a test suite that run all the TestCase methods
that its name finishes by _long.

Exemple:
class MyTest < Test::Unit::TestCase
# This test is executed only in the nightly build
def test_one_long
sleep(3600)
end

# This test will be executed with the quick test task and in the
nightly build
def test_two
sleep(0.4)
end
end

Does anybody have a better idea? Is there some tool that can optimize
the tests covering ?
 
E

Eric Hodel

I have a rake task that lunches all my unit tests. The execution of
those tests may take over 20 mins. I would like to have two rake
task,
one that executes a set of quick tests and one that executes all the
tests that will be executed in a nightly build.

If your tests take twenty minutes, they aren't unit tests. Unit
tests are fast because they only test a unit.

What is it that makes them take 20 minutes or more?
 
M

Martin Martinos

Eric said:
If your tests take twenty minutes, they aren't unit tests. Unit
tests are fast because they only test a unit.

What is it that makes them take 20 minutes or more?
In fact I use unit testing to test a Ruby wapper over a C++ tool that
that takes a long time to execute. In fact it is not for testing the C++
app but to test the wrapper.

I also use it to test our VC++ build and packaging system. Even if I
made small unit test, the whole process takes up to 13 mins.
 
E

Eric Hodel

In fact I use unit testing to test a Ruby wapper over a C++ tool that
that takes a long time to execute. In fact it is not for testing
the C++
app but to test the wrapper.

I also use it to test our VC++ build and packaging system. Even if I
made small unit test, the whole process takes up to 13 mins.

If you only want to test the wrapper you should stub out the C++
app's behaviors and use those stubs instead of the real thing. You
don't specify if this is a command-line wrapper or a ruby extension,
the former will be mork work than the latter :/

For a full integration test you can use the same tests with the real
app (which will take the full amount of time).
 
M

Martin Martinos

Eric said:
If you only want to test the wrapper you should stub out the C++
app's behaviors and use those stubs instead of the real thing. You
don't specify if this is a command-line wrapper or a ruby extension,
the former will be mork work than the latter :/

For a full integration test you can use the same tests with the real
app (which will take the full amount of time).

In fact it is a command line application. I think it is a good idea to
stub it. I think I will do a small ruby script that generates an output
that is similar to c++ application.

Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,828
Latest member
LauraCastr

Latest Threads

Top