-
Website
http://blog.ashmind.com/ -
Original page
http://blog.ashmind.com/index.php/2007/09/05/evaluating-javascript-in-watin/ -
Subscribe
All Comments -
Community
-
Top Commenters
-
regisbsb
3 comments · 1 points
-
Busby SEO Test
1 comment · 1 points
-
Weex
1 comment · 2 points
-
alwin
1 comment · 2 points
-
ctacke
1 comment · 1 points
-
-
Popular Threads
The UATs are meant to be written from the user's perspective. The tests should read that way and reflect what a user would actually do, including how they themselves would verify that an action was successfully completed. The users might even be able to read and understand what the test is trying to do. When you start getting under the hood and fiddling with javascript directly from the test, then it gets further away from being a user test. The user certainly won't be calling javascript to verify that an action they took really did affect the state of the page.
Hitting the javascript also makes the test fragile because it is too tied to the implementation details which make it harder (well just more annoying really) when you want to change the implementation. Why should the (state-based) test care that certain javascript code was called, so long as the end result is that something on the page reflected the expected outcome. With ajax web app testing, this does tend to require some waits, but typically you can get it to wait for a specific expected value to appear or change to happen (i.e. wait for your ajax progress indicator to 'stop' instead of an arbitrary 3000 ms).
When I find myself (instinct) starting down this path, I step back and evaluate what is missing in the ui that is forcing the test to pop the hood. Usually all it needed was a visual indicator to the user that probably should have been there in the first place. Not always. But usually.
But what I was writing this time was closer to JS unit tests — something like "changing the selected value in a combo box should change some property of a global object on the page".
Basically I wanted to fix fragility of my javascript and didn't want to do it with more javascript. Even if WatiN would have to call up the browser for each test fixture.
I recently added the code from Ayende to WatiN. Now I read your code and it looks even better. Is it OK to include this in WatiN?
Jeroen van Menen
lead developer of WatiN
Newbie here. How do I get the WatIN document object to pass and what string code to need to send in.
Thanks,
Gerald
But I have not worked with Watin for a year so I do not really remember anything.