On 06/02/06, Bret Pettichord <[EMAIL PROTECTED]> wrote:
>
> >Is it even possible to combine the assertand if statements in this way?
> No.
>

Hi Bret, I didn't want to give up on this and I managed to get part of it work.

According to the Ruby Cheat Sheet's "Truth and falsehood" section, "In Ruby, anything but the two special values 'false' and 'nil' are considered true for purposes of an 'if' statement."  Since the assert always returns "nil" when it works correctly, I just added a bang to the if statement:

   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).

Thanks for pointing me to the right doc info.

Cheers.  Paul.

(P.S. as an aside, I am sending this msg with different formatting to see if it preserves the formatting and spacing. Sorry about the previous posts.  I didn't know they were being truncated like that.)

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

Reply via email to