Friday, July 19, 2013

Introduction to Web Driver

WebDriver is a web automation framework that allows you to execute your tests against different browsers, not just Firefox (unlike Selenium IDE).
Web driver execute script > Mozilla Firefox, Internet explorer, Safari, Google Chrome, Opera browser.

WebDriver also use a programming language in creating your test scripts(which is not possible in Selenium IDE).
  • Use conditional operations like if-then-else or switch-case 
  • Use looping like do-while.
Following programming languages are supported by WebDriver
  • Java
  • .Net
  • PHP
  • Python
  • Perl
  • Ruby

WebDriver Vs Selenium RC


They both allow you to use a programming language in designing your test scripts. They both allow you to run your tests against different browsers.

It controls the browser from the OS level
All you need are your programming language’s IDE (which contains your Selenium commands) and a browser.

Selenium RC’s architecture is way more complicated.

The Selenium RC Server acts as a “middleman” between your Selenium commands and your browser.
  • When you begin testing, Selenium RC Server “injects” a Javascript program called Selenium Core into the browser.

  • Once injected, Selenium Core will start receiving instructions relayed by the RC Server from your test program.

  • When the instructions are received, Selenium Core will execute them as Javascript commands.
  • The browser will obey the instructions of Selenium Core, and will relay its response to the RC Server.

  • The RC Server will receive the response of the browser and then display the results to you.

  • RC Server will fetch the next instruction from your test script to repeat the whole cycle.

WebDriver is faster than Selenium RC

Selenium RC is slower  since it uses a Javascript program called Selenium Core. This Selenium Core is the one that directly controls the browser, not you.

Limitations of WebDriver


WebDriver Cannot Support New Browsers:


Remember that WebDriver operates on the OS level. Also remember that different browsers communicate with the OS in different ways. If a new browser comes out, it may have a different process of communicating with the OS as compared to other browsers. So, you have to give the WebDriver team quite some time to figure that new process out before they can implement it on the next WebDriver release.

Selenium RC automatically generates an HTML file of test results. The format of the report was pre-set by RC itself. Take a look at an example of this report below.

WebDriver has no built-in command that automatically generates a Test Results File. You would have to rely on your IDE’s output window, or design the report yourself using the capabilities of your programming language and store it as text, html, etc.

WebDriver is a tool for testing web applications across different browsers using different programming languages.
  • You are now able to make powerful tests because WebDriver allows you to use a programming language of your choice in designing your tests.
  • WebDriver is faster than Selenium RC because of its simpler architecture.
  • WebDriver directly talks to the browser while Selenium RC needs the help of the RC Server in order to do so.
  • WebDriver’s APIismore concise than Selenium RC’s.
  • WebDriver can support HtmlUnit while Selenium RC cannot.
  • The only drawbacks of WebDriver are:
  • It cannot readily support new browsers, but Selenium RC can.
  • It does not have a built-in command for automatic generation of test results.

Friday, July 5, 2013

Automation Testing..

Test Cases to Automate
  • Test cases to be automated can be selected using the following criterion to increase the automation ROI
    • High Risk - Business Critical test cases
    • Test cases that are executed repeatedly
    • Test Cases that are very tedious or difficult to perform manually
    • Test Cases which are time consuming
    The following category of test cases are not suitable for automation:
    • Test Cases that are newly designed and not executed manually  atleast once
    • Test Cases for which the requirements are changing frequently
    • Test cases which are executed on ad-hoc basis.
    About Automated Testing
    Manual testing is performed by a human sitting in front of a computer carefully executing the test steps. Automation Testing means using an automation tool to execute your test case suite.   The automation software can also enter test data into the System Under Test ,  compare  expected and actual  results and generate detailed test  reports.
    Test Automation demands considerable investments of money and resources. Successive development cycles will require execution of same test suite repeatedly.
    Automated testing is important due to following reasons: 

    • Manual Testing of all work flows, all fields , all negatice scenarios is time taking and costly.
    • Automation does not require Human intervention. You can run automated test unattended (overnight)
    • Automation increases  speed of test execution
    • Automation helps increase  Test Coverage

    The following category of test cases are not suitable for automation:
    • Test Cases that are newly designed and not executed manually  atleast once
    • Test Cases for which the requirements are changing frequently
    • Test cases which are executed on ad-hoc basis

    • Define the scope of Automation


  • Scope of automation is the area of your Application Under Test which will be automated. Following points help determine scope:
    • Feature that are important for the business
    • Scenarios which have large amount of data
    • Common functionalities across applications
    • Technical feasibility
    • Extent to which business components are reused
    • Complexity of test cases
    • Ability to use the same test cases for cross browser testing

  • Test Execution process

  • Automation Scripts are executed during this phase. The scripts need input test data before there are set to run. Once executed they provide detailed test reports.  
    Execution can be performed using the automation tool directly or through the Test Management tool which will invoke the automation tool.


    Example: Quality center is the Test Management tool which in turn it will invoke QTP for execution of automation scripts. Scripts can be executed in a single machine or a group of  machines. The execution can be done during night , to save time.

    How to Choose an Automation Tool? 

    • Selecting the right tool can be a tricky task. Following criterion will help you select the best tool for your requirement-

      • Environment Support
      • Ease of use
      • Testing of Database
      • Object identification
      • Image Testing
      • Error Recovery Testing
      • Scripting Language Used
      • Support for various types of test – including functional, test management, mobile, etc…
      • Support for multiple testing frameworks
      • Easy to debug the automation software scripts
      • Ability to recognize objects in any environment
      • Extensive test reports and results
      • Minimize training cost of selected tools 

      Benefits of automated testing

       Following are benefits of automated testing:

        • 70% faster than the manual testing
        • Wider test coverage of application features
        • Reliable in results
        • Ensure Consistency
        • Saves Time and Cost
        • Improves accuracy
        • Human Intervention is not required while execution
        • Increases Efficiency
        • Better speed in executing tests
        • Re-usable test scripts
        • Test Frequently and thoroughly
        • More  cycle of execution can be achieved through automation 
        • Early time to market