On Sep 8, 9:27 pm, Robert Walker <[email protected]>
wrote:
> Marnen Laibow-Koser wrote:
> > Piero Di Bello wrote:
> >> Hi
> >> How can I have the tests for my Rails app to be executed in a random
> >> order?
>
> > At least with RSpec, specs are executed in unpredictable order.  I think
> > it's the same each time, but it's not the order in which they appear in
> > the spec file.
>
> > But why do you need this anyway? Each test should start from a clean
> > slate, so the order should be completely immaterial.
>
> First I'll say I completely agree with this. If tests/specs fail or pass
> depending on the order of execution then there must be serious problems
> with your test suite.
>
> Now to address the OP. I know of nothing "built-in" any of the testing
> frameworks for this. What I suppose you would need to do is write your
> own script that searches though your project for all test classes then
> executes them in a random order.
>
> This, however, would only randomize the testing classes, each test
> within each class would still execute in whatever order the test
> framework decided to run them. Which, would mean that you would probably
> also have to replace the test runner with your own that could randomize
> each method of each test class.
>
> In conclusion if this is a solid requirement of your project, I'm really
> glad it's your project and not mine. :)

Thanks for your ideas. I'll definitely explore some of them.
No, it's not a solid requirement, but as I already said in a previous
answer, we find it *very* useful to discover dependencies between
tests as soon as possible (and probably the Rspec authors' find this
important too, given that Rspec execute specs in a random order...).

Thanks
Piero

>
> Good luck.
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to