M
Maciej Szatanik
Hi,
Ill try to explain my problem as clear and as short as possible.
I have a button which does:
Test::Unit::UI::Console::TestRunner.run(Testy)
and i have a class which loads the files if they are not already loaded
tests_to_run_filtered.each do |test|
if $tests_loaded.include?("#{test}") == false
$tests_loaded[$loaded_i] = test
$loaded_i = $loaded_i + 1
load "#{test}"
end
end
and puts them into suite
$numberoftests = 0
suite = Test::Unit::TestSuite.new
suite << START.suite
$tests_to_run.each do |test|
new_str = test.delete "\n"
new_str = File.basename(new_str, ".rb").delete "\n"
new_strup = new_str.upcase + ".suite"
new_strupc = eval("#{new_strup}")
suite << new_strupc
$numberoftests = $numberoftests + 1
end
suite << ENDING.suite
return suite
it all works good.
but
-------------problem begins here----------------
i want to be able to load a test everytime i press my button, tho if i
do that
tests are loaded again, and the program executes it twice.
Lets say i have a test "A" when i load it, program runs "A"
if i have a check not to load files twice it will also run "A"
if i dont check, program loads "A" twice and executes "A""A"
I want to be able to run files after i change sth inside them without
having to restart my aplication.
lets say that test "A" has puts "123" inside
i start a program and run "A" and i get "123"
if i change "123" to "321" i will still get "123" if i dont load the
file again, but i cant do this cos it will run twice.
hope that this is understandable,
i've been working on this for 3 days now, so i ask you to throw some
ideas at me.
Ill try to explain my problem as clear and as short as possible.
I have a button which does:
Test::Unit::UI::Console::TestRunner.run(Testy)
and i have a class which loads the files if they are not already loaded
tests_to_run_filtered.each do |test|
if $tests_loaded.include?("#{test}") == false
$tests_loaded[$loaded_i] = test
$loaded_i = $loaded_i + 1
load "#{test}"
end
end
and puts them into suite
$numberoftests = 0
suite = Test::Unit::TestSuite.new
suite << START.suite
$tests_to_run.each do |test|
new_str = test.delete "\n"
new_str = File.basename(new_str, ".rb").delete "\n"
new_strup = new_str.upcase + ".suite"
new_strupc = eval("#{new_strup}")
suite << new_strupc
$numberoftests = $numberoftests + 1
end
suite << ENDING.suite
return suite
it all works good.
but
-------------problem begins here----------------
i want to be able to load a test everytime i press my button, tho if i
do that
tests are loaded again, and the program executes it twice.
Lets say i have a test "A" when i load it, program runs "A"
if i have a check not to load files twice it will also run "A"
if i dont check, program loads "A" twice and executes "A""A"
I want to be able to run files after i change sth inside them without
having to restart my aplication.
lets say that test "A" has puts "123" inside
i start a program and run "A" and i get "123"
if i change "123" to "321" i will still get "123" if i dont load the
file again, but i cant do this cos it will run twice.
hope that this is understandable,
i've been working on this for 3 days now, so i ask you to throw some
ideas at me.