I have this one script that I'm working on that is just getting bigger as I go along.  I would like to break out some of the smaller chunks/tests into separate script files, but I'm not sure of the logistics of this.  I tried looking at the unittests but I couldn't answer my questions by looking at them.

For example, my one (master) script is set up like the following:
----
#includes
#global variables

class TC_blahblahblah < Test::Unit::TestCase
    def cust_method_1
        ...
    end

    def cust_method_2
        ...
    end

    test_a_somename
        yadda yadda yadda
    end

    test_b_somename
    ....
end
----

Now, if I break out "test_a_somename" into a separate script, what is the correct format for calling/running it from within the master script?

In the new sub-script, do I have to repeat the "class TC_blahblahblah < Test::Unit::TestCase" structure, or just put the "test_a_somename" structure?  Do I have to re-include all the require/include lines that were in the master script?  (I don't think I should, but I'm not sure.)

If I have methods that are defined in the master script, will they be properly called from one of the sub-scripts, or do I have to put them in the sub-scripts too? (I expect it to work if they're only defined in the master script.)

Please forgive these basic questions.  I searched the message archives but I couldn't find anything helpful other than "you should break up large scripts into smaller ones when they get too long (like ~ 1000 lines)".  And I haven't had any success scanning the other Ruby/Watir documentation to give me practical advice on how to do this either.

Paul.

_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to