As suggested on StackOverflow I am posting this question here as well.
I am having trouble how to implement the Given step (with SpecFlow for example) of a logged in user role throught Web UI automation (with WatiN for example).
Let's say I have the following feature:
Feature: Site usage overview
As an admin
I want to view a site usage overview
So that I know how many visitors my site attracts
This feature uses the admin user role. One possible scenario would be:
Scenario: Admin should see site usage
Given I am logged in as an admin
When I navigate to the Site usage overview page
Then I should see the site usage statistics
This is just as an example. The scenario could also be written with clicking buttons or links and validating some text on the page or something, but I'm not going into that discussion.
What I want to know is how to implement this Given step. I see a couple of options:
- Writing all the stuff for logging in as some admin (go to login page, log in as admin)
- Verifying some loggid in state that is visible on every page (currently logged in as ...)
But what if the authentication mechanism is Windows Authentication (Integrated Security / Active Directory) or something similar in other environments and there is no visible indication of your logged in status and you need to be logged in for every page in the whole site?
I hope I am missing something and someone can point me in the right direction.