Ruby scrips getting executed in a loop.

P

Parul Korea

While calling multiple ruby scripts into a single file, my scripts are
getting executed in a loop. Can someone please suggest me how to carry
out the execution of all the scripts just once?
For eg., I have abc.rb, xyz.rb being called out in a single file run.rb
 
J

Jesús Gabriel y Galán

While calling multiple ruby scripts into a single file, my scripts are
getting executed in a loop. Can someone please suggest me how to carry
out the execution of all the scripts just once?
For eg., I have abc.rb, xyz.rb being called out in a single file run.rb

What do you mean by "called out"? Can you show the code?
While execution of run.rb, abc.rb and xyz.rb gets executed once and
after completion, again the execution of abc.rb starts and the loop
continues.

One scenario I imagine is if you are using load to load the files:

run.rb:
load 'abc.rb'
load 'xyz.rb'

abc.rb:
#something

xyz.rb:
load 'abc.rb'

This will execute abc.rb twice. It can also happen if you are using
require but with different paths to abc.rb, for example:

run.rb:
require 'lib/abc'

lib/xyz.rb:
require 'abc'

I think we need more info to understand your problem.

Jesus.
 
P

Parul Korea

Following is the piece of code in Run.rb . All the three files are
placed at the same location.

Require 'abc.rb'
require 'xyz.rb'

suite = Test::Unit::TestSuite.new()
suite << TestSuite_abc.suite
suite << TestSuite_xyz.suite
FileUtils.mkdir_p 'E:\Ruby\reports'
Test::Unit::UI::Reporter.run(suite, 'E:\Ruby\reports', :html)

The last piece of code is for generating a combined html report.

Initially, abc.rb and xyz.rb gets executed individually. After getting
executed once, a new “unnamed†testsuite gets loaded which combines the
test cases in both the scrips and execute them together.
I am not sure whether the problem is due to the last piece of code which
deals with report generation or is there any other issue ?
 
J

Jesús Gabriel y Galán

Following is the piece of code in Run.rb . All the three files are
placed at the same location.

Require 'abc.rb'
require 'xyz.rb'

suite =3D Test::Unit::TestSuite.new()
suite =A0<< TestSuite_abc.suite
suite =A0<< TestSuite_xyz.suite
FileUtils.mkdir_p 'E:\Ruby\reports'
Test::Unit::UI::Reporter.run(suite, 'E:\Ruby\reports', :html)

The last piece of code is for generating a combined html report.

Initially, abc.rb and xyz.rb gets executed individually. After getting
executed once, a new =93unnamed=94 testsuite gets loaded which combines t= he
test cases in both the scrips and execute them together.
I am not sure whether the problem is due to the last piece of code which
deals with report generation or is there any other issue ?

Sorry, I don't know much about Test::Unit::UI:Reporter, maybe someone
with experience using that can chime in?

Jesus.
 

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

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top