From: Parul Korea on
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
From: Jesús Gabriel y Galán on
On Thu, Aug 5, 2010 at 8:28 AM, Parul Korea <parulg(a)covelix.com> wrote:
> 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.

From: Parul Korea on
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 ?

--
Posted via http://www.ruby-forum.com/.

From: Jesús Gabriel y Galán on
On Thu, Aug 5, 2010 at 9:32 AM, Parul Korea <parulg(a)covelix.com> wrote:
> 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 ?

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

Jesus.