Here is some code that i've written. I'm trying to create a suite.rb that could automatically run plain ruby scripts in the Test::Unit framework. I think this would help a lot of the users who find Test::Unit confusing.

But i can't quite get the script to run correctly. Any hints? It's an easy problem, until you try to make assertions work.

class TestSuite < Test::Unit::TestCase
  @binding = binding
  require 'test/unit/assertions'
  include Test::Unit::Assertions
  def test_lab5_1
    script = File.read('lab5_1.rb')
    class_eval(script, @binding, 'lab5_1.rb')
  end
end

At 02:17 PM 8/29/2005, Jeff Wood wrote:
There are a number of ways you can do it.

You should use the Ruby Test::Unit framework.

>From there, you can either wrap each of your existing test scripts
with a function and have one test case object that contains all of
them

Or you can build a separate class to wrap each of your scripts and
then build a TestSuite object to call all of those ...

Either one works, it really depends on the size of your scripts and
how much of the functionality of those tests is duplicated, because
wrapping multiple of those in the same TestCase object would then
allow you to break out that functionality and therefore not repeat
yourself.

Hope that made sense... Ask if you need more detail.

j.

On 8/29/05, Torres, Ben (HQP) <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I've been writing a test script for each individual test case.  How do I
> consolidate all my test scripts into a master test script so all I would
> need to execute is the master test script?  Will I need to make each
> testcase a function?
>
> Thanks,
> Ben
>
>
> _______________________________________________
> Wtr-general mailing list
> Wtr-general@rubyforge.org
> http://rubyforge.org/mailman/listinfo/wtr-general
>


--
"So long, and thanks for all the fish"

Jeff Wood

_______________________________________________
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

_____________________
 Bret Pettichord
 www.pettichord.com

_______________________________________________
Wtr-general mailing list
Wtr-general@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to