views:

435

answers:

2

.NET application being tested uses <authentication mode="Forms"> so whenever an instance of WatiN.Core.IE is created the login page appears.

Can successfully fill in the login form and authenticate, but wondering how to handle this for multiple tests? As soon as the IE instance is released, the next test must log in again.

Does WatiN have a mechanism for handling this?

Any advice on how to handle the login to test these password protected pages?

+2  A: 

The approach I took was to create a base test class with a [TestInitialize] attribute. In this method I log in to the login page and use the "remember me" option.

Next time the browser loads any page it is already logged in.

Not pretty, but it works for now.

Any better ways?

+1  A: 

When I want to share a login between tests, I initialize the test fixture with a setup method that creates an instance of IE and logs in. I use that same instance of IE for all the tests in the fixture, and then have a teardown method that logs out and closes and disposes of IE. Each individual test begins with ie.GoTo(UrlToBeTested).

Leslie
Sounds like a good approach, will try