Hi Aidy, Thanks for your inputs.
I am not very clear what can we use Rspec for? How is it better that Test::Unit? I am thinking of trying to integrate watir with TestLink, as it has dual advantage. It allows me to maintain test cases and gives me an interface to execute my tests. Besides that It has reporting mechanism, which will help me to generate execution reports. Regards, Natasha aidy lewis <[EMAIL PROTECTED]> wrote: Natasha, I would try to stay away from using globals and use an instance variable instead or pass your browser object across classes. You could use traditional Rspec instead of Test::Unit - this will also give you a HTML report. There are examples on the Watir framework's page and on rsepc.info. Aidy 2008/11/19 Natasha : > > Hi All, > > Can someone help me in writing better efficient code for the > following: > > Following is a snippet of my of my tests: > ----------------------------------------------------------------------- > require 'watir' # the controller > require 'test/unit' > > Watir.options_file = 'C:/natasha/RubyScripts/FinalAutomatedTests/ > options.yml' > $ie = Watir::Browser.new > > class Ordertest < Test::Unit::TestCase > > def test_a_orderPlacement > > if (ARGV.length != 4) > puts 'Usage: > ' > $ie.close > exit > end > > test_site = $ARGV[0] > user = $ARGV[1] > pwd = $ARGV[2] > pcode = $ARGV[3] > > $ie.goto(test_site) > > # Accessing Gift Certificate link > $ie.link(:text,"Products").click > $ie.link(:text,"Find out more about gift certificates.").click > > # Select postcard as gift certificate > $ie.text_field(:id,"pc_cert_qty").set("1") > $ie.button(:index,"1").click > > # providing access code > $ie.text_field(:id,"txtPromoCode").set(pcode) > $ie.button(:id,"btnRedeem").click > > #Logging in > $ie.radio(:id,"radAccountMode_return").click > $ie.text_field(:id,"txtSignInEmail").set(user) > $ie.text_field(:id,"txtSignInPassword").set(pwd) > $ie.button(:id,"btnLogin").click > > # Placing the order > $ie.button(:id,"btnPaymentDone").click > > # Signing out > $ie.link(:title,"Sign out of MOO").click > $ie.close > > end # end of test_orderplacement > > end > ----------------------------------------------------------------------------------------------- > > What could be the best way to rewrite it? > > Thanks a ton, > Natasha > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Watir General" group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/watir-general -~----------~----~----~----~------~----~------~--~---