Testcase order

M

Mario Ruiz

I'm trying to run different testcases in a file:
require 'testcases/dopTest'
require 'testcases/bipTest'
require 'testcases/canTest'

But when I run it the order is not as I wrote it. First it's run bipTest
and the last one dopTest.

How can I sort the order I want?

Thanks.
 
G

Gordon Thiesfeld

I'm trying to run different testcases in a file:
require 'testcases/dopTest'
require 'testcases/bipTest'
require 'testcases/canTest'

But when I run it the order is not as I wrote it. First it's run bipTest
and the last one dopTest.

How can I sort the order I want?

Name them in alphabetical order.
 
T

Thomas Preymesser

[Note: parts of this message were removed to make it a legal post.]

So it's impossible to run the testcases in the 'require' order


Each of your test should be independent from the other tests.
Why do you want to run them in a specific order?

-Thomas
 
M

Mario Ruiz

Because I'm running testcases that need the result of another one so
must be run first.
 
P

Phlip

Mario said:
Because I'm running testcases that need the result of another one so
must be run first.

You are breaking "test isolation". The very least problem is, when a test fails,
you will have little idea where to look for the problem - the production code
that this test calls? last test? or its production code?

Decoupling tests forces you to strongly decouple your production code. This is a
major benefit that helps some major projects, such as Rails.

Google for "Expensive setup is a design smell".
 
R

Ryan Davis

Because I'm running testcases that need the result of another one so
must be run first.

Don't do that. You don't want your testcases coupled to each other.
really. Refactor your tests and decouple them from each other and
you'll be much much happier in the long run.
 
P

Paul McMahon

Because I'm running testcases that need the result of another one so
must be run first.

Testcases should run in issolation. One testcase should not be
dependent on another.
 

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

Forum statistics

Threads
474,289
Messages
2,571,450
Members
48,127
Latest member
svastipharmancrr

Latest Threads

Top