Test Driven Developer
You got a TEST for that?
Home
|
Syndication
|
Sign In
Monday, July 21, 2008
Comparing WatiN and Selenium For UI Testing
Both
Selenium
and
WatiN
have been around for a while, and both are fairly good tools when it comes to UI automated testing. Both tools now drive both IE7 and FF2, and are free to download. I have been using Selenium RC for a while now, and it seems to be fairly robust, although sometimes rather frustrating and somewhat slow. Both have a recorder mechanism, and both emit C# code for me. However the WatiN recorder did blow sky high with an unhandled exception when a pop-up window came up, but
the recorder code
was written by someone else so I won't hold it against WatiN.
I tried WatiN for the first time today, and decided to go with the V.2 CTP instead of the .NET 1.1 release. It seems that some of the API's have been refactored into more sensible structures (factory patterns, etc.), but somehow the things that would have made the most sense to me in the API were structured much differently that I would have expected. There were some problems with my IE (it kept crashing unless I ran the debug version of W2). However, I blame this on IE, not on W2. FF has a plug-in that needs to be manually installed. It comes with the CTP, but doesn't get installed. Hopefully this will be integrated by release.
Most of the basic features are similar in function but not implementation. I can see writing an interface class and a couple of wrapper classes that implement the interface, one each for WatiN and Selenium, so we can have the best of both worlds.
WatiN Pro's
No proxy server required. It just runs. Runs both FF and IE, switchable with the parameter to the factory method that creates the instance.
WatiN Con's
Documentation is less than sparse.
I could not find a way to do a "drag and drop" which is easily accomplished with Selenium.
Does not handle pop-up windows. This was the show-stopper for me.
Selenium Pro's
polished code
well-documented functionality
lots of examples
handles lots of weird types of conditions and situations (most of which we will all need at some point.)
Selenium Con's
have to run a java proxy in a separate process and set it up and tear it down
slow in places, due to proxy and not-so-well-written sections of code
locators aren't always easy to figure out. Tools like
Firebug
and
XPather
help identify locator strings.
Since it does not handle pop-up windows (or I just couldn't figure it out in about 4h of research), this was the end of the line for it. Selenium does handle them, and has been able to accomplish 100% of the weird scenario tests I have needed so far. Loads of tweaking and frustrating trial and error notwithstanding.
So, until we have a bit closer to release for WatiN, Selenium still wins (for now). However, I definitely plan to write the interface and shim both out so I can use either or both later on. Stay tuned for that posting, that will be the money shot...
In closing, let me just reiterate that every developer should be thinking about UI automated testing for web code. Each user-interactive element on the page NEEDS AN ID. That's every link, every button, every text box, checkbox, radio button, and other user input elements. The ID's need to be simple, and either fixed, or predictable. With these things in place in the production code, it will be testable and easier to validate. Better quality code will make it out to the hands of the users, and all will be right with the world. Amen.
<steps down from soapbox./>
Automation
|
C#
|
Selenium
|
Testing
|
WatiN
Monday, July 21, 2008 10:18:35 PM (Pacific Standard Time, UTC-08:00)
Comments [1]
|
Tuesday, July 22, 2008 6:21:27 PM (Pacific Standard Time, UTC-08:00)
Would you have a look at
InCisif.net
?
ftorres
Comments are closed.
© Copyright 2008, John E. Boal
Calendar
<
December 2008
>
Sun
Mon
Tue
Wed
Thu
Fri
Sat
30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1
2
3
4
5
6
7
8
9
10
Total Posts: 30
This Year: 30
This Month: 0
This Week: 0
Comments: 17
Archives
November, 2008 (2)
October, 2008 (2)
September, 2008 (4)
August, 2008 (3)
July, 2008 (5)
June, 2008 (4)
May, 2008 (1)
April, 2008 (2)
March, 2008 (4)
February, 2008 (2)
January, 2008 (1)
On this page
categories
ABN
Acceptance Criteria
ATDD
Automation
C#
Mocks
MSTest
Python
Refactoring
Selenium
SQL
TDD
Testing
Tools
Unit Tests
WatiN
Links
Home
Test Driven Development, Defined (Wikipedia)
Test Driven Design
Test-Driven.com - Agile development tools
NUnit
Book: Test-Driven Development in Microsoft .NET
CodeProject - Advanced Unit Testing: Unit Test Patterns
John Boal's Personal Blog
John Boal's Agile Development Blog
Blogroll
OPML
Lazy Coder
Scott Koon's Blog
#2782
Ade Miller's Tech Blog
Agile Development
Mitch Lacey's Agile Development Blog
Espresso Fueled Agile Development
Mike Puleio's Blog
Geek Noise
Noise de Peter Provost
Sneal's Blog
Shawn Neal's Blog
Search
About
© Copyright 2008, John E. Boal
Sign In