Okay, how that works is voodoo, man.

I understand what you mean by clarity (compared to my not-nil-if-block), but it's unintuitive to me how the next line is magically attached to the "assert" command without some kind of "if" statement.

Can you describe how this line coherence works?  I noticed some strange behaviour in one script that I can't figure out yet.  Here's what my script does (in pseudo code):

def test_case_01
    open browser
    goto Reset Password page
    enter incorrect email address
    check that the correct error message appears ("assert" & output here)
    press the "cancel" button to return to the Login page
end

What I noticed is that if the assert line passes, then this script works as expected.  However, if the assert *doesn't* pass (i.e. the "contains_text" fails to find the message), then the next line is skipped.  So the "cancel" button is never pressed and the remaining test cases all break because they're not starting from the correct [login] page.

To get around this, I moved the "Press the "cancel" button" command to the start of the next test case.  That way it starts from the right place.

Do you know why this line is skipped (no matter how many blank lines I put between them) if the assert line fails?

Paul.


On 07/02/06, Bret Pettichord <[EMAIL PROTECTED]> wrote:
This would be clearer and has the same results:

   assert($ie.contains_text("Please try again"))
   puts "TEST PASSED. Found test string: 'Please try again.' "

Bret

On 2/7/06, Paul Carvalho <[EMAIL PROTECTED] > wrote:

   if ! assert($ie.contains_text("Please try again"))
      puts "TEST PASSED. Found test string: 'Please try again.' "
   end

So now my script will output "Test Passed" if the assertion passes (i.e. = "nil").  The "else" doesn't work, but then it's kind of redundant to print "Test Failed" anyway since the failure info appears at the end of the run (as expected).



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

Reply via email to