Skip to Content
In anticipation of posting about a new topic I’m going to wrap up my Watir Automated testing posts with a few more top tips. UPDATE: I’ve been asked for links to my previous posts on Automated Testing so especially for Dave: Automated Functional Testing – Part 1 of …Automated Functional Testing – Part 2 of …Automated Functional Testing – Part 3 of …Automated Functional Testing – Part 4 of …Automated Functional Testing – Part 5 of …Automated Functional Testing – Part 6 of …TOP TIP – How do I run a single test? So you have lots of tests in your test suite but only want to run one? No need to create an ad-hoc test case, simply pass in the –name parameter when running the test: ruby test_mytestcase.rb --name test_just_this_methodTOP TIP – How do I run the test in background mode? Running the test so you can see what is going on in the browser is sometimes useful but most of the time you’ll want to run the tests in the background and just see the results. This is easily done by passing the -b parameter on the command line: ruby test_mytestcase.rb -bTOP TIP – Helper methods I have a couple of helper methods which I use in most of my test cases:def should_find(find_me)   assert(@ie.contains_text(find_me), "*
*
*
Text not found: #{find_me}
*
*
*") end       def should_not_find(find_me)   assert_nil(@ie.contains_text(find_me), "*
*
*
Found text which should not be present: #{find_me}
*
*
*") end
No clever code here it just means I can write tests which are easier to read:should_not_find("Portal Runtime Error") should_find("Success")FINWell I’m running out of content about testing as you can probably tell! So I guess that’s a wrap. I’ll no doubt re-visit automated testing again at some point but for now that’s my lot. NEXT TIMEI’ve been working on creating web services for Enterprise Portal and calling those web services from Microsoft .Net. I’ve taken lots of notes, so expect a series of EP web services posts real soon.
To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

  1. David Halitsky
    Justin –

    Can you provide links to your previous posts ?
    (Never cite your own posts without providing links – the lazy among us like me just won’t go there.)

    Thanks again
    Dave

    (0) 
  2. Johannes Kammerer
    I was just looking for a way to log off the user.

    The problem is the confirmation Dialog Box that should be given a “yes” Button click.
    Any Tip ?

    (0) 
  3. Justin Ramel Post author

    Here’s the code I use for log off                    autoit.Send(‘‘)<br/>  end<br/>          <br/>          #Make pop up window appear<br/>          @ie.link(:title, “End the current portal session and log off”).click<br/>     end          <br/>end

    (0) 

Leave a Reply