Thanks for the information. I would like to add one more point.:
If your application is making AJAX requests then this solution will not work directly. The HTTP authentication prompt will be shown. In order to bypass that what can be done is from the test case directly fire the URL for which the Ajax request will be sent by the application later. This will create the HTTP authorization header which will be carried in all subsequent requests including the Ajax requests and the authentication prompt will not be shown thus enabling smooth execution of the test case.