running changed files.

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.
 
M

Maciej Szatanik

ok i changed a lot, and i just use

$tests_to_run.each do |test|
system("ruby '#{test}'")
end

feel stupid i didn't do that earlier :) it does what i want, doesnt load
to my application, just runs tests as a separate processes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top