SlideShare a Scribd company logo
Presentation script

Slide 1 - HTTP authentication in automated testing – problems and solutions

Igor Cernopolc
igor.cernopolc@gmail.com

This subject has its roots in my personal experience of more than 4 years in testing field. I will describe the problems that
were encountered, and solution found during testing of a web app that required HTTP authentication.


Slide 2 – HTTP Authentication dialogs

Here you can see examples of how this dialog looks.


Slide 3 - Usage

HTTP Authentication is s solution easy to implement and at the same time relatively secured. That is why it is often used in
intranets, back office application, in the cross domain authentication.

In our testing task, depending of the app specifics, we can often get to deal with HTTP authentication dialogs. Handling it is
no issue for a manual tester, but problems appear when we have to write automated tests for our app.

Let’s see what the biggest problems that this dialog is raising are.


Slide 4 - Main problems

The first and the most visible problem raised is that the HTTP authentication dialog is a non-HTML dialog. There are few
web testing, free tools that can handle this kind of dialogs. Let’s take a classic example, Selenium; it is almost powerless in
handling non-HTML dialogs.


Slide 5 - Main problems

Another problem is generated by the requirement of an application to be supported by the majority of current browsers.
Each browser vendor implements his own HTTP authentication dialog style, in order to respect browsers style and add new
functionalities. In this way, we have lots of implementations for the same authentication method, each of them being more
complex and hard to be tested than others.


Slide 6- Main problems

In conclusion, we have to deal with a non-html dialog that has more appearances that we would like. Which is the
consequence of these issues?


Slide 7 -Consequence

There are too many workarounds for handling a HTTP authentication dialog during automated testing. The most used
solutions will be presented in the next slides.


Slide 8 - Solutions

The first and the most used solution is to embed credentials in http request header. An easy to implement solution, but there
are browser that don’t support it anymore and it does not work in all cases.

Slide 9 - Solutions

A valid solution for Firefox is to use profiles. Tester can create a specific profile with embedded credentials and settings,
and load this profile every time it is needed. An interesting solution, but limited only on Firefox.


Slide 10 - Solutions

Another solution our friend Google suggests us is using specific cookies when loading the page, but most of the application
the need to be secured don’t allow this type of connection.

Solutions presented until now can be considered browser based. There also some external solutions that will be described in
the next slides.


Slide 11 - Solutions

One option is to use add-on, Firefox add-on AutoAuth specifically. Tester can save his credentials for a specific domain and
each time an http authentication dialog appears, it is handled by the add-on. Sounds very well and simple to use, but the
same as profiles, it is limited to Firefox.


Slide 12- Solutions

Another identified solution is more generic and has a specific approach on the problem. Java Robot class can simulate
keyboard typing into fields, acting like a human interaction with the app. In this way the solution is not a browsed related
one, it can be used on any browser. One big disadvantage can be found for it, there is no way to connect to the dialog, the
input is done blind and we cannot be sure that we type our credentials into correct fields.


Slide 13- Solution

The last solution found that deserves to be mentioned is using external application like AutoIT or Siculi. These are
designated for GUI testing and general scripting. They can handle any non-html dialogs including HTTP authentication or
Load File.


Slide 14 – Smile

As you can see, the world is not so dark and even the hardest problems have solutions.


Slide 15 – Toolbox

What we can do when we need a solution to work on all current browsers? We can pay a couple of hundreds or thousands
euros for a dedicated solution, or we can make our own one. Using a right combination of tools can be a good choice and
save you big money.


Slide 16 - 18– My Solution

In the next slides, a solution implemented by me is presented. At the company I work, the most used tool for web testing is
Selenium (Webdriver) with tests written in java. All I had to implement is a module that will handle the non-HTML dialogs.
AutoitX was my choice. It is a library that lets the tester to write and call autoit command directly from java code.
The combination formed from Webdriver, Java and AutoitX is my solution for our problematic HTTP authentication dialog,
solution described in the diagram.
Slide 19-20 – My Solution

Let’s start with a simple test case:
Open and login to a web page
Verify the login was successful by validating a page element

Our solution is interesting from the start, because the problem itself is interesting. We have to deal with a login dialog that
appears on page load. Before implementing the solution, selenium was freezing waiting for the correct page response until
timeout was reached.


Slide 21-22 – My Solution

The on load authentication dialog we treated by using 2 threads of execution. In one method we combined the page load and
handle of authentication. The most important thing to mention is that user need to start the helper thread, the one that will
handle the dialog, before opening the desired page.


Slide 23-24 – My Solution

All the helper thread is doing is to wait for the authentication dialog to appear and when it was found, to enter the provided
credentials and click OK.


Slide 25-27 – My Solution


After the authentication dialog is accepted, browser renders the page and in the main thread, selenium finishes the load
method, closes the helper thread and passes execution to next verifications.


Slide 28 – Limitations

We mentioned some limitations for all the solutions described in this presentation, our solution is also not limitations free.
Autoit is a windows based app, in order to run on other OS, another approach should be found.
Another limitation was found during distributed test runs. Autoit is an external tool and running through Selenium grid is
problematic. The local instance of autoit is called instead of the remote ones.


Slide 29 – Limitations

Even if we have limitations in our solution, if we need a fix, and are perseverant, we can try to use Siculi in order to fix the
OS dependency. For the second limitation, theoretically, we can use external autoit script calls and not the autoitX calls, or
mirror the local workspace on remote machines.


Slide 30 – Conclusions

Don’t be afraid of using multiple tools when it is required. Combine and innovate and you will succeed.

Thank you for attention

If you are interested to get a demo app containing the presented code and solution, please contact me:
igor.cernopolc@gmail.com

More Related Content

PPTX
Test Driven Development (TDD) Preso 360|Flex 2010
PPTX
Installation of Silk Test Framework
PPTX
How to build your own Android App -Step by Step Guide
PDF
Design Patterns : Solution to Software Design Problems
PDF
Design Patterns - The Ultimate Blueprint for Software
PPT
Why test with flex unit
PDF
Design patterns 1july
PPT
Five essential elements for successful software development
Test Driven Development (TDD) Preso 360|Flex 2010
Installation of Silk Test Framework
How to build your own Android App -Step by Step Guide
Design Patterns : Solution to Software Design Problems
Design Patterns - The Ultimate Blueprint for Software
Why test with flex unit
Design patterns 1july
Five essential elements for successful software development

What's hot (12)

PPTX
Develop MS Office Plugins
PPTX
7 Reasons Why React Native Development is a Good Choice for Long – Term
PDF
Code Camp Applying Modern Software Development Techniques To Ui Testing
PPTX
Amp Up Your Visual Studio Productivity
PPTX
Introduction to AntiPatterns & CodeSmells
PPT
Automated Testing vs Manual Testing
PPTX
Software Engineering
PPT
Test-Driven Development
PPT
Test Driven Development
PPT
Test-Driven Development
PDF
29 Essential AngularJS Interview Questions
PPTX
Improving Estimates
Develop MS Office Plugins
7 Reasons Why React Native Development is a Good Choice for Long – Term
Code Camp Applying Modern Software Development Techniques To Ui Testing
Amp Up Your Visual Studio Productivity
Introduction to AntiPatterns & CodeSmells
Automated Testing vs Manual Testing
Software Engineering
Test-Driven Development
Test Driven Development
Test-Driven Development
29 Essential AngularJS Interview Questions
Improving Estimates
Ad

Viewers also liked (7)

PDF
CodeCamp Iasi 10 march 2012 - websockets-with-atmosphere
PPT
Distributed load testing (Local vs Cloud)
PPTX
CodeCamp Iasi 10 March 2012 - Gabriel Enea - ASP.NET Web API
PPTX
CodeCamp Iasi 10 march 2012 - Intro
PDF
Igor Cernopolc - Http authentication in automated testing - presentation
PPTX
Diana antohi me against myself or how to fail and move forward
PDF
Cezar chitac the edge of experience
CodeCamp Iasi 10 march 2012 - websockets-with-atmosphere
Distributed load testing (Local vs Cloud)
CodeCamp Iasi 10 March 2012 - Gabriel Enea - ASP.NET Web API
CodeCamp Iasi 10 march 2012 - Intro
Igor Cernopolc - Http authentication in automated testing - presentation
Diana antohi me against myself or how to fail and move forward
Cezar chitac the edge of experience
Ad

Similar to Igor Cernopolc - Http authentication in automated testing - presentation script (20)

PPTX
Test Driven Development (TDD) with FlexUnit 4 - 360|Flex San Jose preso
PDF
Selenium - The Way Of Success
DOCX
Tutorial test driven development with Visual Studio 2012
PPTX
The Best Automated Testing Tools in 2020
PPT
Teamwork Presentation
PDF
Continuous integration
PPT
Stepin evening presented
PDF
Selenium with testng and eclipse ide
PPTX
Bdd masterclass
PPSX
Developers Border Line: Unit Testing
PPTX
Debugging in UiPath.pptx
DOCX
Multi tool test automation platform
PPTX
DevOps - Continuous Integration, Continuous Delivery - let's talk
 
PDF
Webinar: Design Patterns : Tailor-made solutions for Software Development
PDF
Changes in programmer tools' infrastructure
PPTX
STARWEST 2010 - 7 Steps To Improving Software Quality using Microsoft Test Ma...
PDF
The Testing Planet Issue 2
PDF
Professional web development with libraries
PPTX
UI Integrations Test
PDF
Top 3 selenium IDE alternatives for Chrome and Firefox
Test Driven Development (TDD) with FlexUnit 4 - 360|Flex San Jose preso
Selenium - The Way Of Success
Tutorial test driven development with Visual Studio 2012
The Best Automated Testing Tools in 2020
Teamwork Presentation
Continuous integration
Stepin evening presented
Selenium with testng and eclipse ide
Bdd masterclass
Developers Border Line: Unit Testing
Debugging in UiPath.pptx
Multi tool test automation platform
DevOps - Continuous Integration, Continuous Delivery - let's talk
 
Webinar: Design Patterns : Tailor-made solutions for Software Development
Changes in programmer tools' infrastructure
STARWEST 2010 - 7 Steps To Improving Software Quality using Microsoft Test Ma...
The Testing Planet Issue 2
Professional web development with libraries
UI Integrations Test
Top 3 selenium IDE alternatives for Chrome and Firefox

More from Codecamp Romania (20)

PPTX
Cloud powered search
PPTX
Business analysis techniques exercise your 6-pack
PPTX
Bpm company code camp - configuration or coding with pega
PPT
Andrei prisacaru takingtheunitteststothedatabase
PPTX
Agility and life
PPTX
2015 dan ardelean develop for windows 10
PDF
The bigrewrite
PDF
The case for continuous delivery
PPTX
Stefan stolniceanu spritekit, 2 d or not 2d
PPTX
Sizing epics tales from an agile kingdom
PPTX
Scale net apps in aws
PPTX
Raluca butnaru corina cilibiu the unknown universe of a product and the cer...
PPTX
Parallel & async processing using tpl dataflow
PDF
Material design screen transitions in android
PDF
Kickstart your own freelancing career
PDF
Ionut grecu the soft stuff is the hard stuff. the agile soft skills toolkit
PDF
Ecma6 in the wild
PDF
Codecamp2015 pimp yourpipeline-saade-jens-1.1
PPTX
Code camp iasi silviu niculita - machine learning for mere mortals with azu...
Cloud powered search
Business analysis techniques exercise your 6-pack
Bpm company code camp - configuration or coding with pega
Andrei prisacaru takingtheunitteststothedatabase
Agility and life
2015 dan ardelean develop for windows 10
The bigrewrite
The case for continuous delivery
Stefan stolniceanu spritekit, 2 d or not 2d
Sizing epics tales from an agile kingdom
Scale net apps in aws
Raluca butnaru corina cilibiu the unknown universe of a product and the cer...
Parallel & async processing using tpl dataflow
Material design screen transitions in android
Kickstart your own freelancing career
Ionut grecu the soft stuff is the hard stuff. the agile soft skills toolkit
Ecma6 in the wild
Codecamp2015 pimp yourpipeline-saade-jens-1.1
Code camp iasi silviu niculita - machine learning for mere mortals with azu...

Igor Cernopolc - Http authentication in automated testing - presentation script

  • 1. Presentation script Slide 1 - HTTP authentication in automated testing – problems and solutions Igor Cernopolc igor.cernopolc@gmail.com This subject has its roots in my personal experience of more than 4 years in testing field. I will describe the problems that were encountered, and solution found during testing of a web app that required HTTP authentication. Slide 2 – HTTP Authentication dialogs Here you can see examples of how this dialog looks. Slide 3 - Usage HTTP Authentication is s solution easy to implement and at the same time relatively secured. That is why it is often used in intranets, back office application, in the cross domain authentication. In our testing task, depending of the app specifics, we can often get to deal with HTTP authentication dialogs. Handling it is no issue for a manual tester, but problems appear when we have to write automated tests for our app. Let’s see what the biggest problems that this dialog is raising are. Slide 4 - Main problems The first and the most visible problem raised is that the HTTP authentication dialog is a non-HTML dialog. There are few web testing, free tools that can handle this kind of dialogs. Let’s take a classic example, Selenium; it is almost powerless in handling non-HTML dialogs. Slide 5 - Main problems Another problem is generated by the requirement of an application to be supported by the majority of current browsers. Each browser vendor implements his own HTTP authentication dialog style, in order to respect browsers style and add new functionalities. In this way, we have lots of implementations for the same authentication method, each of them being more complex and hard to be tested than others. Slide 6- Main problems In conclusion, we have to deal with a non-html dialog that has more appearances that we would like. Which is the consequence of these issues? Slide 7 -Consequence There are too many workarounds for handling a HTTP authentication dialog during automated testing. The most used solutions will be presented in the next slides. Slide 8 - Solutions The first and the most used solution is to embed credentials in http request header. An easy to implement solution, but there
  • 2. are browser that don’t support it anymore and it does not work in all cases. Slide 9 - Solutions A valid solution for Firefox is to use profiles. Tester can create a specific profile with embedded credentials and settings, and load this profile every time it is needed. An interesting solution, but limited only on Firefox. Slide 10 - Solutions Another solution our friend Google suggests us is using specific cookies when loading the page, but most of the application the need to be secured don’t allow this type of connection. Solutions presented until now can be considered browser based. There also some external solutions that will be described in the next slides. Slide 11 - Solutions One option is to use add-on, Firefox add-on AutoAuth specifically. Tester can save his credentials for a specific domain and each time an http authentication dialog appears, it is handled by the add-on. Sounds very well and simple to use, but the same as profiles, it is limited to Firefox. Slide 12- Solutions Another identified solution is more generic and has a specific approach on the problem. Java Robot class can simulate keyboard typing into fields, acting like a human interaction with the app. In this way the solution is not a browsed related one, it can be used on any browser. One big disadvantage can be found for it, there is no way to connect to the dialog, the input is done blind and we cannot be sure that we type our credentials into correct fields. Slide 13- Solution The last solution found that deserves to be mentioned is using external application like AutoIT or Siculi. These are designated for GUI testing and general scripting. They can handle any non-html dialogs including HTTP authentication or Load File. Slide 14 – Smile As you can see, the world is not so dark and even the hardest problems have solutions. Slide 15 – Toolbox What we can do when we need a solution to work on all current browsers? We can pay a couple of hundreds or thousands euros for a dedicated solution, or we can make our own one. Using a right combination of tools can be a good choice and save you big money. Slide 16 - 18– My Solution In the next slides, a solution implemented by me is presented. At the company I work, the most used tool for web testing is Selenium (Webdriver) with tests written in java. All I had to implement is a module that will handle the non-HTML dialogs. AutoitX was my choice. It is a library that lets the tester to write and call autoit command directly from java code. The combination formed from Webdriver, Java and AutoitX is my solution for our problematic HTTP authentication dialog, solution described in the diagram.
  • 3. Slide 19-20 – My Solution Let’s start with a simple test case: Open and login to a web page Verify the login was successful by validating a page element Our solution is interesting from the start, because the problem itself is interesting. We have to deal with a login dialog that appears on page load. Before implementing the solution, selenium was freezing waiting for the correct page response until timeout was reached. Slide 21-22 – My Solution The on load authentication dialog we treated by using 2 threads of execution. In one method we combined the page load and handle of authentication. The most important thing to mention is that user need to start the helper thread, the one that will handle the dialog, before opening the desired page. Slide 23-24 – My Solution All the helper thread is doing is to wait for the authentication dialog to appear and when it was found, to enter the provided credentials and click OK. Slide 25-27 – My Solution After the authentication dialog is accepted, browser renders the page and in the main thread, selenium finishes the load method, closes the helper thread and passes execution to next verifications. Slide 28 – Limitations We mentioned some limitations for all the solutions described in this presentation, our solution is also not limitations free. Autoit is a windows based app, in order to run on other OS, another approach should be found. Another limitation was found during distributed test runs. Autoit is an external tool and running through Selenium grid is problematic. The local instance of autoit is called instead of the remote ones. Slide 29 – Limitations Even if we have limitations in our solution, if we need a fix, and are perseverant, we can try to use Siculi in order to fix the OS dependency. For the second limitation, theoretically, we can use external autoit script calls and not the autoitX calls, or mirror the local workspace on remote machines. Slide 30 – Conclusions Don’t be afraid of using multiple tools when it is required. Combine and innovate and you will succeed. Thank you for attention If you are interested to get a demo app containing the presented code and solution, please contact me: igor.cernopolc@gmail.com