开发者

how to implement a given logged in user role through UI automation?

开发者 https://www.devze.com 2023-03-17 04:21 出处:网络
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).

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 th开发者_开发百科at 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号