Establish context with Watin
Posted
by Ian Quigley
on Stack Overflow
See other posts from Stack Overflow
or by Ian Quigley
Published on 2010-03-22T10:28:12Z
Indexed on
2010/03/22
10:31 UTC
Read the original article
Hit count: 533
Feel free to tell me I'm doing this wrong but...
I have the Watin attribute [Browser("IE")]
and want to extend this attribute so that it will perform an action (login) to establish the context for the test (setup).
I've created
public class LoggedInBrowserAttribute : BrowserAttribute
which takes URL
, username
, password
and performs the login steps. However, if for some reason the username/password won't login to the system I don't want to perform the test. In the GetBrowser
method I'm doing an Assert (is logged in) which seems wrong.
What is the correct way to establish this context / abort the test? I don't want to return null
from GetBrowser
and then have if (browser == null)
at the top of my test.
© Stack Overflow or respective owner