I have a working test-unit test suite so far, but it bothers me that the
test runner itself is in a directory far separated from the test scripts
and related code I have:
/automation/config
/helpers
/module1_scripts
/test_results
the test runner used, though is under C:(Ruby
home)\lib\ruby\1.8\test\unit\ui\xml\testrunner.rb, which is far away
from the rest of my code.
A ‘suite’ currently looks like:
require ‘test/unit’
require ‘config/config_manager’
#define config vars
$config = ConfigManager.new(“platform1”,“test”)
#test dev mock test
require ‘SiteManager/MEP_SM_TEST’ #test to run
Currently, I run the test from the command line with the following:
ruby -rtest/unit/ui/xml/testrunner SM_test_dev_suite.rb --runner=xml
If I change to -r option location to the copy of the runner in the
‘automation’ directory I get an error, and similarly when I omit the
–runner option. Both seem to be necessary, which requires the
testrunner executed to be under the Ruby home subdirectory and not local
to my other test files as I would like.
I have seen examples of explicitly starting the test runner, but in
trying to modify that to point to my local runner implementation I get
an error. I’m trying something like:
require ‘test/unit’
require ‘test/unit/testsuite’
require ‘runner/testrunner’
require ‘config/config_manager’
#define config vars
$config = ConfigManager.new(“VZW”,“test”)
#mock test
require ‘SiteManager/MEP_SM_TEST’ #test to run
class TS_test_dev_suite
def self.suite
suite = Test::Unit::TestSuite.new
suite << MyTestDev.suite
return suite
end
end
runner = MMSTestRunner.new(TS_test_dev_suite)
…and when I execute “ruby SM_test_dev_suite.rb” I get the following
error:
SM_test_dev_suite.rb:22: uninitialized constant MMSTestRunner
(NameError)
I want to be able to implement a custom test runner for specific
reporting output control but I want it to be local to the rest of my
test code to make version control easier to map (so that all of my code
is under one directory). For some reason I can get the one under the
Ruby directory to run. Any help would be appreciated.