Take a look at the documentation for test/unit:
http://www.ruby-doc.org/stdlib/libdoc/test/unit/rdoc/classes/Test/Unit.html
The method to run the test suite should be outside your test suite class.
TestSuite also doesn't have setup and teardown methods, those are test case
methods. No reason to call start on the TestRunner, creating a new instance
and running it will start the test run.
So your suite should look more like this:
require 'includes'
require 'a'
require 'b'
class TS_MyTests
def self.suite
suite = Test::Unit::TestSuite.new("All tests")
suite << TC_a.suite
suite << TC_b.suite
return suite
end
end
FileUtils.mkdir_p 'C:/Program Files/Watir/examples/test
_cases/report'
Test::Unit::UI::Reporter.run(TS_MyTests.suite, 'C:/Program
Files/Watir/examples/test
>
> _cases/report',:html)
>
-Charley
On 2/5/07, steven <[EMAIL PROTECTED]> wrote:
I have a bunch of test cases in separate .rb files. For this example,
a.rb and b.rb.
I then created an rb file to run all of them, called suite_my_tests.rb
In this file I have:
require 'includes'
require 'a'
require 'b'
class TS_MyTests
def setup
#CBrowser.openMyBrowser()
end
def teardown
#CBrowser.closeMyBrowser()
Test::Unit::UI::Reporter.run(TS_MyTests.suite, 'C:/Program
Files/Watir/examples/test_cases/report',:html)
end
def self.suite
#Test::Unit::UI::Console::TestRunner.new(suite).start
suite = Test::Unit::TestSuite.new("All tests")
suite << TC_a.suite
suite << TC_b.suite
#Test::Unit::UI::Console::TestRunner.new(suite).start
FileUtils.mkdir_p 'C:/Program
Files/Watir/examples/test_cases/report'
#Test::Unit::UI::Reporter.run(TS_MyTests.suite,
'C:/Program Files/Watir/examples/test_cases/report',:html)
return suite
end
end
I have two questions:
The only time this line seems to
run:Test::Unit::UI::Reporter.run(TS_MyTests.suite,
'C:/Program Files/Watir/examples/test_cases/report',:html)
is when it is between a begin and end outside of the main class in the
file above - it won't run in the #teardown or in the def self.suite. Am I
missing something?
Also, I have the following line commented out:
#Test::Unit::UI::Console::TestRunner.new(suite).start
Any reason why I would need it uncommented?
Thanks,
Steve
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6414&messageID=18139#18139
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general