Re: [Watinfixture-users] Arrays of checkbox controls with differentVALUE's
Status: Alpha
Brought to you by:
kalnir
|
From: Rob M. <rma...@rm...> - 2007-09-14 20:02:27
|
Jeff,
Thanks... but I really didn't explain myself well.
Unique ID's (which are an excellent idea and should be everywhere) won't
really help my problem.
Using the example (which is not the real test... the real test would take
forever to explain)...
The test is "enable a particular user" or "disable a particular user".
Ideally I want the test to operate _based on user id_ ... this is important
(because I have similar checkbox lists in other locations and a general
solution is desired).
I can't construct the ID to be a composite of field + userid... because
userid may contain invalid characters (and any replacement scheme _could_
result in duplicates).
All that means... is that hardcoding by a constructed ID or by a general
index (checkbox[index]) is just not going to work (especially given I have
other instances of these lists).
So I think I really do need something like:
|verify checkbox|<NAME or ID>|with value|<VALUE>|exists|
|check checkbox|<NAME or ID>|with value|<VALUE>|
or even
|verify checkbox|<ID>|with value|<VALUE>|exists|
|verify checkbox with name|<NAME>|with value|<VALUE>|exists|
What you've said about how the matching of method names does help a ton. I
can track down the code... just to verify what you're saying.
But... any idea of why my rebuilt WatinFixture.DLL is resulting in the
exceptions? Is there anything specific I need to be doing to rebuild
"correctly" (any mucking with references... and so forth)?
Thanks a ton!!
Rob
ps. I have a couple of other things I hope to add:
1. |click button|<ID>|with confirm|yes|
- A scheme to handle javascript Confirm and Alert popups
2. Pulling error messages into the test results (eg. if a server side
validation fails it would be nice if the test results page could include the
actual text of the error message)
-----Original Message-----
From: Jeff Parker [mailto:Jef...@ex...]
Sent: September 14, 2007 3:02 PM
To: Rob MacFadyen; wat...@li...
Subject: RE: [Watinfixture-users] Arrays of checkbox controls with
differentVALUE's
Rob,
The first problem you have is that your controls are not uniquely named.
It would be easier if you named your controls uniquely.
<table>
<tr>
<td>User Id</td>
<td>Allowed</td>
<td>No allowed</td>
</tr>
<tr>
<td>
<input type=checkbox id=Allowed_1 name=Allowed value="abc">
</td>
<td>
<input type=checkbox id=NotAllowed_1 name=NotAllowed value="abc">
</td>
</tr>
<tr>
<td>
<input type=checkbox id=Allowed_2 name=Allowed value="123">
</td>
<td>
<input type=checkbox id=NotAllowed_2 name=NotAllowed value="123">
</td>
</tr>
</table>
The addition of ID should allow you to look up each control directly without
affecting your program.
Unfortunately, WatiNFixture is not currently designed to deal with
collections of controls like checkboxes that all have the same name.
If you look a little closer at the code, you'll see that UserActions
inherits from the DoFixture class. This class translates the function names
into plain sentences with spaces. For example,
public bool TakeMyAnd(string objectIdentifier, string actionValue)
The DoFixture class translates this into the plain sentence:
|take my|football|and|punt|
DoFixture somehow knows how to translate this and call the TakeMyAnd
function. The first unmatched item in pipe (|) symbols is the first
variable, the second unmatched item in pipe (|) symbols is the second
variable, and so forth.
As far as how to verify those checkboxes, the best way would be to give each
a unique id value, then use VerifyCheckboxIsChecked:
|verify checkbox|Allowed_1|is checked|
|verify checkbox|NotAllowed_2|is checked|
There's no method today to perform VerifyCheckboxHasValue, but this command
would be:
|verify checkbox|Allowed_1|has value|abc| verify
|checkbox|NotAllowed2|has value|123|
And its corresponding function would be:
public bool VerifyCheckboxHasValue(string checkboxID, string
checkboxValue)
However, it sounds like verifying the checkbox has that value is not really
what you're looking for.
WatiNFixture was written from the perspective of a user working with your
application. So one question you can ask is, if I put a checkbox here and a
checkbox here and hit submit, what does the user expect the application to
do?
If the user is supposed to see a confirmation message after the button is
clicked, check for that.
If this is for security and after the admin makes changes, the user's
experience is supposed to change, then you need to have WatiNFixture log out
the current test admin, login the test user that is supposed to be affected,
and check to make sure what is supposed to be shown is shown, and what is
not supposed to be shown is not shown.
Jeff
-----Original Message-----
From: wat...@li...
[mailto:wat...@li...] On Behalf Of Rob
MacFadyen
Sent: Friday, September 14, 2007 1:36 PM
To: wat...@li...
Subject: [Watinfixture-users] Arrays of checkbox controls with
differentVALUE's
Hey all,
I have a web page that uses "arrays" of controls (i.e. the controls all have
the same NAME value). For example imagine a web page that looks like:
User Id Allowed Not Allowed
------- ------- -----------
abc [ ] [ ]
123 [ ] [ ]
the HTML would look like (outlook syntax and formatting enabled):
<table>
<tr>
<td>User Id</td>
<td>Allowed</td>
<td>No allowed</td>
</tr>
<tr>
<td>
<input type=checkbox name=Allowed value="abc">
</td>
<td>
<input type=checkbox name=NotAllowed value="abc">
</td>
</tr>
<tr>
<td>
<input type=checkbox name=Allowed value="123">
</td>
<td>
<input type=checkbox name=NotAllowed value="123">
</td>
</tr>
</table>
On the server side of processing you end up with 2 arrays, Allowed and
NotAllowed, with entries only for CHECKED checkboxes... and the entry values
are the specified values. Kind of goofy.... but this is _not_ asp.net stuff.
So... my challenge is how to Verify/Check these critters?
What I need to do is specify an ID/NAME _and_ a VALUE.
Looking at the WatiNFixture code I can see that all the UserActions seem to
follow the following pattern:
|MethodNamePrefix|A_User_Entered_Value|MethodNameSuffix|
But I'm unclear on how/why this is so.
What I'd like is:
|!-WatiN.Contrib.WatiNFixture.UserActions-!|
|open browser|
|navigate to|http://localhost/somedarntestpage|
|verify checkbox|TeamMember|value|abc|exists|
The code I think I need is:
public bool VerifyCheckboxValueExists(string checkboxID, string
checkboxValue)
{
// actually do something
return false;
}
But... I don't see how/where to wire up any of the plumbing for getting two
values passed.
Also when I did a quick and dirty test (i.e. just added the code above) now
my test crashes with:
System.TypeLoadException: Could not load type 'fitlibrary.FixtureBase'
from
assembly 'FitLibrary, Version=1.0.2339.33496, Culture=neutral,
PublicKeyToken=null'.
at System.Reflection.Assembly.GetExportedTypes()
at fit.ObjectFactory.GetTypeOrInstance(TypeName typeName,
GetTypeOrInstanceDelegate getTypeOrInstance)
at fit.Fixture.LoadFixture(String className)
at fit.Fixture.DoTables(Parse tables
Which makes no sense to me either :)... after I compiled the changes I just
copied the .dll over to my fitness/dotnet directory... is there something
else I should be doing?
So... long and the short... I'm pretty lost :)
Any suggestions?
Regards,
Rob
ps. Note that once the basic verify checkbox by value works I'll want to
extend this to include "is checked", "is not checked", and somehow for
"check checkbox", "uncheck checkbox" and "click checkbox"... maybe with:
|check checkbox with value|<ID>|value|<VALUE>|
------------------------------------------------------------------------
-
This SF.net email is sponsored by: Microsoft Defy all challenges.
Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Watinfixture-users mailing list
Wat...@li...
https://lists.sourceforge.net/lists/listinfo/watinfixture-users
|