Question

What is the best way to test my webforms applications?

Looks like people are loving Watin, and selenium.

Was it helpful?

Solution

UPDATE: Given WatiN has been stagnant for over a year now, I would direct anyone that needs web ui tests towards selenium, it is in continuous use & development by many contributors, and is actively used by Google.

WatiN is the best that I've found. It integrates into Visual Studio unit testing or nunit & you can do pretty much anything you need in the browser (click links, submit forms, look for text/images, etc.)

See the following questions for similar answers:

OTHER TIPS

Just wondering, why would you call WatiN a unit testing tool? Last time I checked, it ran integration tests.

The best way would be to move all code that doesn't depend on HttpContext to a separate assembly and run unit tests as usual. The rest can be tested with Ivonna. She doesn't test the client behavior, that's where WatiN can be helpful; however, if you want to test your pages or controls in isolation, she's your only choice.

That's the biggest shortcoming of Webforms -- it's, for all practical reasons, untestable in terms of unit testing of testing controllers, etc.

That is one of the major advantages of the MVC framework.

I tend to favor the approach of separating the buisness logic out of the UI code. Here's an article that describes a unit test friendly pattern (Model-View-Presenter)

http://www.unit-testing.net/CurrentArticle/How-To-Use-Model-View-Presenter-With-AspNet-WebForms.html

I would use a tool like WaitIn:

" WatiN is Web Application Testing in .NET, and this Test Recorder will generate chunks of source for you by recording your clicks in an embedded IE browser" (from Scott Hanselman's blog - which I found thanks to another post on StackOverflow

WaitIn website

I'd go with WATIR (Web Application Testing in Ruby) - http://wtr.rubyforge.org/. We (Acsys Interactive) have been using for about a year and the tool is great.

I developed a simple wrapper in .NET so that I can execute my WATIR scripts from Unit tests. The framework is incredible and you have entire Ruby power behind you. There's support for Firefox & Safari (FireWatir project).

It's very similar to WATIN (in fact I think WATIN was inspired by WATIR) but I find that WATIR community is much larger than WATIN one.

There're test recorders out there that you can use and tons of tutorials.

It's really your choice. If you feel like the tests need to be in .NET and you don't want to support any other language then your choice is WATIN. On the other hand, if you want to try a fun and quite powerful scripting language (that's what Ruby is) then go for WATIR.

Question to WATIN guys, does it support FireFox/Safari?

Here is a review of Watin,Watir and Selenium http://adamesterline.com/2007/04/23/watin-watir-and-selenium-reviewed/

Apparently Selenium worked quite slow for the tester but if you'll notice, as one of the comments points out, that this is only the case due to its support of multiple browsers.

However there is a CTP (Community Technology Preview) release of WatiN which offers support for both Internet Explorer and FireFox automation.

I have had a great experience using Selenium. Web tests can be very fragile, but here is an article from my blog where I talk about how to make the tests less fragile. http://www.unit-testing.net/CurrentArticle/How-To-Make-Web-Tests-Less-Fragile.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top