I am using Microsoft Visual Studio and Selenium to test a webpage. This particular website requires a user to login to the web page and based on some settings, some elements will be displayed and some won't. There are only two types of users. What is the best design to implement tests like these? I am only validating the existence of elements or the lack of.

But for both users I would sometimes run the same test. I considered using Visual Studio's TestCategories, but it can't figure out how to switch a variable per test category.


I would have 4 types of tests:

  • unauthenticated functionality
  • authentication ('login') tests for happy and sad paths
  • tests for content for user type 1 (admin?)
  • tests for content for user type 2 (standard user?)

I don't know your framework but those are the high level groups.

Within each of those I would have detailed tests for specific functionality and for happy, sad and options paths.

  • happy: when everything goes right and user enters information perfectly
  • sad: when the user doesn't enter information correctly and gets errors.
  • options: when the user enters additional optional information (happy and sad)

Creating the appropriate users is usually one of the trickiest parts of this area. Your options are usually:

  • use an existing user
  • use the UI to create the users
  • use seed data
  • use special accounts only for staging/testing

You should work with the company, its process and the test framework to select the most appropriate approach.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.