|
List Info
Thread: Re: How to run all the steps defined in a method even if any of step fails?
|
|
| Re: How to run all the steps defined in
a method even if any of step fails? |
  India |
2007-04-11 09:22:09 |
|
Hi Charley and Paul,
If I use rescue true in the method, i wont be getting any error all the methods will execute. But, the method which has error does not shows what actual error it has.
Here is the code which i executed
def test_yahooSite test_site = 'http://www.mail.yahoo.com' $ie = IE.new $ie.goto(test_site) assertTextfield assertCheckbox #If this method fails it wont execute the next method assertButton end def assertTextfield assert($ie.text_field(:id,"username").exists?, "Username text field does not exist") assert($ie.text_field(:id,"passwd").exists?, "Password text field does not exist") end def assertButton assert($ie.button(:value,"Sign In").exists?, "Sign In button does not exist") end def
assertCheckbox assert_equal($ie.checkbox(:id, "persistent",2).isSet?, "Keep me signed in, check box is not checked") rescue true end
Is there any other way which executes all the steps defined in the method even any of the step fails and also should show the message why it has failed?
That's what I get for answering emails before finishing my first cup of coffee. 
-c
On 4/10/07, Paul Carvalho <gmail.com" href="mailto:tester.paul gmail.com"> tester.paul gmail.com> wrote: You're repeating yourself, Charley. This new assertions.rb covers one aspect of
what Watir User asked but not the other: "Its not only related to assertions .. ". That's why I described a general Ruby construct for recovering from methods regardless of what Watir version you're using.
Cheers. Paul C.
Check out what you're missing if you're not on Yahoo! Messenger
|
|
|
| Re: How to run all the steps defined in
a method even if any of step fails? |

|
2007-04-11 09:55:17 |
|
On 4/11/07, watir-user watir-user < watir_user yahoo.co.in">watir_user yahoo.co.in> wrote:
Is there any other way which executes all the steps defined in the method even any of the step fails and also should show the message why it has failed?
Of course. Read "Exceptions, Catch, and Throw" chapter from "Programming Ruby" (
http://phrogz.net/ProgrammingRuby/tut_exceptions.html).
This is sample code.
begin raise rescue puts $! end
Zeljko
-- ZeljkoFilipin.com
|
[1-2]
|
|
|
about | contact Other archives ( Real Estate discussion Medical topics )
|