I create a tool that automates the process, then runs some tests on its own results, then performs some other actions.
While trying to clear my code, I created a separate file that just has a class of test cases. Now, before I can run these tests, I must pass a couple of parameters / objects to the class before they can be run. Now the problem is that I cannot find a way to pass the parameter / object to the test class.
At the moment, I'm going to create a Yaml file and read it in a test class, but it considers it "wrong" to use a temporary file for this. If someone has a more pleasant solution, it will be great!
************** Edit ************
Sample code for what I'm doing right now:
require 'test/unit/ui/console/testrunner'
require 'yaml'
require 'TS_SampleTestSuite'
automatingSomething()
importantInfo = getImportantInfo()
File.open('filename.yml', 'w') do |f|
f.puts importantInfo.to_yaml
end
Test::Unit::UI::Console::TestRunner.run(TS_SampleTestSuite)
Now, in the example above, TS_SampleTestSuite needs importantInfo, so the first “test case” is a method that simply reads in the information from the Yaml filname.yml file.
I hope this confuses some confusion.
source
share