In my experience, the code works like this:
verify((condition), message="text")
and you can use whatever you want for the condition. There is also a
verify_equal method that works pretty much the same way. I see there
is also a verify_match method, but I've never used it. Also, I've
been able to use various string methods in the error message.
Here are some more examples:
verify_equal(transactionReasonId, policy_TransactionReasonId,
message=("Policy_TransactionReasonId is incorrect"))
verify(($ie.text_field(:name, "mailingAddress").value != "123 Bad
Address"), message="Address changes were not reset after canceling a
Change Mailing Address modification for account: " + @accountName +
".")
verify(($ie.checkbox(:name, "sendDocumentation").checked?),
message="The Send Documentation box is not enabled by default for
account: " + $accountName + ".")
I assume that you could use .selected? the same way.
I haven't done much with logging yet, but I've seen in other posts,
that you can redirect the output from your script to a text file like
this:
watir_test.rb > file_name.txt
I think I'm going to give that a try now. I kind-of like seeing the
status real-time, though.
-Tiffany
On Dec 10, 2:02 pm, Jason Shelton <
jas.shel...@hotmail.com> wrote:
> Will the '.selected?' and '.value ==' assertions work with this? Also, how do you output this to a .txt file? Thanks again.
>
> Shelton
>
> > Date: Mon, 10 Dec 2007 12:25:03 -0800> Subject: [wtr-general] Re: Test/unit assertions> From:
tcfo...@yahoo.com> To:
watir-...@googlegroups.com> > > I may not understand the test/unit assertions well enough, but I ran> into the same problem. Rather than spending a lot of time trying to> figure it out, I decided to use the watir assertions instead. My> checks look something like this:> > verify(($ie.link(:text, "OK").exists?), message="OK link doesn't> exist.")> > If the condition fails, the message is displayed (in my case, just to> the command prompt where I'm running my tests, but I think they could> be written to logs as well).> > Hope this helps!> > -Tiffany> > On Dec 10, 12:54 pm,
jas.shel...@hotmail.com wrote:> > All,> >> > I am new to test/unit, and I have a couple of questions that I hope> > you can assist me with. First, when an assertion fails, the script> > automatically stops running. Is there a way to have an assertion> > fail, and continue running the rest of the test? What I really need> > is a way to say, if an assertion passes do 'x', and if the assertion> > fails do 'y', without the script stopping completely if 'y' is> > prompted. What kind of code can I write to interpret the result of> > each assertion? Thanks in advance for your assistance.> >> > Shelton> _________________________________________________________________
>
> Connect and share in new ways with Windows Live.
http://www.windowslive.com/connect.html?ocid=TXT_TAGLM_Wave2_newways_...