# Waiting for exeution to end

**URL:** <https://www.ruby-forum.com/t/waiting-for-exeution-to-end/125365>\
**Category:** Ruby\
**Created:** [January 8, 2008, 5:08pm UTC](https://www.ruby-forum.com/t/waiting-for-exeution-to-end/125365 "2008-01-08T17:08:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![shinji](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c6cbf5/32.png) [@shinji](https://www.ruby-forum.com/u/shinji)\
**Post date:** [January 8, 2008, 5:08pm UTC](https://www.ruby-forum.com/t/waiting-for-exeution-to-end/125365/1 "2008-01-08T17:08:55Z")

</div>

I have a snippet of code like this:

class TestSuite \< Watir::TestCase  
File.open(ARGV[0]||‘testlist.txt’).each\_line do |entry|  
if entry[0] == “#”  
pass  
else  
code = lambda{load “#{entry.strip}.rb” }  
self.send(:define\_method, entry.strip, code)#{load  
“#{entry.strip}.rb” }#puts “#{entry.strip}”  
#self.send(:public, entry.strip.to\_sym )  
end  
end  
end

if $0 == **FILE**  
require ‘test/unit/ui/console/testrunner’  
Test::Unit::UI::Console::TestRunner.run(TestSuite)  
end

which basically is a harness to run a load of tests using WATIR. I’ve  
written some reporting tools, using a class called Grapher. What I’d  
like to happen, is the test suite runs, then the grapher performs its  
task. However, if I place the call to grapher after the line  
Test::Unit::UI::Console::TestRunner.run(TestSuite), it executes before  
the tests have completed execution.

I’m looking for an elegant solution to this - should I spawn a process  
or something?

---

<div class="post-metadata">

**Author:** ![shinji](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c6cbf5/32.png) [@shinji](https://www.ruby-forum.com/u/shinji)\
**Post date:** [January 9, 2008, 4:36pm UTC](https://www.ruby-forum.com/t/waiting-for-exeution-to-end/125365/2 "2008-01-09T16:36:22Z")

</div>

is there a way to use yield here around the execute line?
