Establish context with Watin
- by Ian Quigley
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.