Partager via


Testing WebPages that uses Windows Authentication for different credentials

One of our customer asked us this

“Coded UI test tool is not recording the steps when IE user session is different from logged in user. I have opened the IE session with test user(Domain\testuser) and Coded ui test builder with logged in user. When I try to record the steps using Coded UI Test builder, steps are not recorded. But opening IE and Coded UI Test Builder tool with same credentials, all steps are recorded properly.”

This happens because you can’t access DOM when the Client is running as different user as compared to the IE process.

If you want to test your Web Application for different users you can follow the below steps :-

a) Enable “prompt for user name and password” in IE -> Tools –> Options. This will enable user to login to the Web page with different user credentials as compared to the IE process.

clip_image001

b) When you try to open a web page that uses Windows Authentication it will popup below dialog asking for Domain user and Password. With this the IE will still be running as logged in user but your web application is logged in with the credentials you provided.

clip_image001[6]

 

With the above setting now you can record your Manual Test / Coded UI Test for different users.

 

Note: You need to record typing of user name and password on the above dialog so that it can be played back. Also the dialog changes from XP\Win2k3 vs VIsta or higher. So you need to manually change the generated to code and check for the OS on which the test is running and perform action depending on that. You can record the action done on dialog on xp / vista machine and put in your test code.

Comments

  • Anonymous
    July 28, 2010
    There has to be a different way for users to run different accounts. A way to launch the brower using something like UIIndexWindows.username In 2008 the "Web Test" now called "Web performance Test" have/had the ability to add usernames and passwords directly to each test