Very cool. Thanks Bret.


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Bret Pettichord
Sent: May 13, 2006 12:41 AM
To: [email protected]
Subject: [Wtr-general] Running test methods in the order i defined them

Many people have expressed dissatisfaction with the fact that Test::Unit executes tests in alphabetical order rather than the order defined.

I've put together a small patch to Test::Unit to fix this problem. It is attached and also included in the Watir 1.5 repo.

require 'watir/testcase'
 
Simply requiring the patch will not change behavior. To change the way the methods in a single test case are executed use " execute :sequentially"

class TC2_Sequential < Test::Unit::TestCase
  execute :sequentially
  def test_b; print 'E'; end
  def test_a; print 'F'; end
  def test_d; print 'G'; end
  def test_c; print 'H'; end
end


To have all your test cases execute this way

Test::Unit::TestCase.default_order = :sequentially

For your entertainment, you can also specify the following options in either of these contexts

:alphabetically # pre-existing order
:reversed_alphabetically
:reversed_sequentially

Michael, did i get the parts of speech correct here?

The default order governs cases where a test case specific directive is not provided. Note that the test cases themselves are still run alphabetically. One thing at a time.


Bret
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to