automation guide - v0.1

Upload: rav123

Post on 07-Apr-2018

237 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/6/2019 Automation Guide - V0.1

    1/15

    Automation Framework

    1. Introduction

    This Automation Framework Document outlines the automation architecture, approach,execution and result flow in SELENIUM RC.

    2. Approach

    The test automation framework is developed using open source tool SELENIUM (IDE &RC)and JAVA. The proposed Framework provides Data-driven and the Keyword-driven support.The User Actions, Input values and Test Data are recorded and read from XLS & other filesand write results in to the XLS files.

    3. Framework Features

    In addition to standard features such as performing operations and verifications on theobjects theframework includes other sophisticated features.

    The key features of the automation framework are listed below:

    Supports-Multiple Browsers and Operating Systems (Higher Automation ROI).

    Windows Internet Explorer and Google Chrome.

    Mac Mozilla Firefox and Safari. Test scripts are generated using MS-Excel (Keyword Action Approach).

    Handles multiple datasets captured in MS-Excel.

    Use of variables: Variables can be defined and used across the generated test

    script.

    Reports: Customized reporter messages can also be used to perform effective analysis

    on execution reports. These reports can be customized to display the pass or failcondition of any functionality. Generates HTML Summary Report on completion of testexecution.

    Exception handling: Runtime errors can be effectively handled and reported using thisframework.

    Highly Modularized and Reusable Functions: This framework supports a functionaldecomposition approach. This increases the reusability of functions, which inturn reduces the unnecessary repetition of steps.

    Easy to update and maintain (Scripts & MS-Excel). Developed using Selenium with Java interface.

    Keyword-Driven Automation Framework: Keyword-based test design and testautomation is formed on the idea that the discrete functional business events thatmakeup any application can be described using short text description (keywords).

    Data-driven testing: This framework supports data-driven testing by importing datafrom an external data sheet.

    Maintenance: Simple modifications to the application can be easily handled inthecode. The changes will be done only in the external file containing the code andthe scripts need not be changed.

    Test Execution Report will be sent automatically through the Email.

    Selenium was first written in Java but it also supports .Net, Ruby, Perl, PHP andPython. This is a big plus when you want to build your framework in a language thathas the highest adoption in the organization it is being built within.

    You can instantiate several concurrent tests with Selenium.

    Test Automation Framework is application-independent: This Automation Framework is

    application-independent because the Open Source Test Automation Framework isdesigned to perform operations for all standard object types (WebEdit, Weblist,Webcheckbox, etc.) of technology commonly used to build a Web application.

    This Test Automation Framework reduces maintenance and increases productivity.

  • 8/6/2019 Automation Guide - V0.1

    2/15

    Effectiveness in handling unexpected application behavior.

    Keywords are application-independent.

    Benefits: Reusability, greater test productivity, optimum utilization of the tool throughkeyword support, and minimum effort needed to build scripts, Conditional checking,Data-driven testing, Reports, Exception handling, Handling Web objects.

    Reduced dependency on technically skilled resources.

    Reliable: The framework provides standardized, tested code.

    Flexible in test suite and test case configuration.

    Test Script development is possible without a functioning application.

    Test cases designed in this framework are less prone to human errors.

    If functionality changes, only the specific test scenario needs to be changed.

    Actual and expected results are stored in Result Folder.

    You can Run the AUT in different Browsers in single Testscript.

    It minimizes the requirement of manual software tester.

    4. Folder Structure

    Figure: Folder Structure.

    4.1. IATF:

    This is the main folder with subfolders as shown in the above diagram. Here the IATF is theProject Name. The Project IATF contains subfolders or files that should not be renamed ormoved. The project Folder (IATF) contains the sub folders like libraries, properties, Results,Testscripts, Testsuites and JAR file (iatf). As shown in the above figure.

    4.2. Libraries:

    The libraries folder contains the Selenium related JAR files

    4.3. Properties:

    The properties folder contains the two type of property files.

    1. Application Property.

    2. UI Element Property.

    Figure: Application Property File and UI Element Property File.

    1. Application Property.

    This Property file contains some one time Configuration details such as serverHost,serverPortNo, browser, application URL and some others details which are changes based onApplication build such as buildNo ,buildDate, MODE_OF_RUN.This file contains data related to the particular Application under Automation Test.

    Example:

    # Application properties fileserverHost=localhost

  • 8/6/2019 Automation Guide - V0.1

    3/15

    serverPortNo=4444browser=*firefox,*iexploreMODE_OF_RUN=NbuildNo=32buildDate=3rd Feb, 2011

    2. UI Element Property File.

    This Property file contains the actual Application related UI element objects which aremap with some logical name. This logical name must match with the data under columnnamed as UI Element of testscript in order to fetch element object for process.This file contains data related to the particular Application under Automation Test.

    Example:

    #UI Element Property file for Login and Logout Flow.frmLogin.lblLoginTitle=x-auto-1-labelfrmLogin.txtUID=username-inputfrmLogin.txtPWD=password-inputfrmLogin.chkBoxRememberMe=x-auto-12frmLogin.btnLogin=//table[@id='aff']/tbody/tr[2]/td[2]/em/button

    frmLogin.lnkLogout=link=Log out

    Before running the Driver script the Property Files should be updated appropriately and thescripts should available under TestSuite folder.

    4.4. Results:

    The Results folder contains the status of each testscript(Including testscript status along withindividual steps whether Pass, Fail etc). We can see in the above figure the Results folder

    contains the Timestamp and each timestamp will consists of below sub folders as follows:

    Abort: Once the testscript under execution mark as aborted then that will move to AbortFolder

    Fail: Once the testscript under execution mark as fail then that will move to Fail Folder

    Pass: Once the testscript under execution mark as pass then that will move to Pass Folder

    The testScript based on the status (pass/Fail/Abort) move to the respective folder and saved

    with the name that included suffix at the end of the file name that specify for which browserthe particular script run for.

    The suffix could be:

    FF- shortcut for Firefox

    IE- shortcut for Inter

    SF- shortcut for Internet Explorer

    CH- shortcut for Chrome

  • 8/6/2019 Automation Guide - V0.1

    4/15

    ScreenShots: while executing the testsuite, if any steps mark as fail ,then the ScreenShotswill be captured and moved to ScreenShots Folder

    TestSummary_timestamp: After the execution of all testScript inside TestSuite this file willbe updated with several information.

    4.5. Testscripts:

    This folder contains all Application related testscript. Only those scripts would executewhich are available under Testsuites folder.

    4.6. TestSuites:

    All the testscripts(copy from Testscripts folder) available under this folder will beexecuted as part of automation.

    4.7. iatf.jarThis file act as a driver Script. Once everything done as mentioned above, user can run this

    file from command prompt.

    4.6. Test Suite:

    Test Suite folder contains the list of test scripts (N number of test scripts) for execution. Thescripts that need to be executed are copied under Test Suite folder before execution.Remember that the scripts name should be unique in the Test Suite. In test Suite we can runN number of Test Scripts.

    In TestSuite folder contains the TestScript or N number of TestScripts as shown below:

    In TestSuite you just copy and paste the TestScripts / TestScript (xls).

  • 8/6/2019 Automation Guide - V0.1

    5/15

    5. Test Script Structure (xls)

    Test Script (xls) is the sequence of keywords/actions designed to test one or more aspects ofthe application (AUT) being tested.Test Scripts (.xls) written by the tester have 4 worksheets as follows

    MainTestScript,

    Datapool,

    Iteration and

    Log

    These above mentioned sheet name must be appear as written above.

    5.1. MainTestScript / Test Script Worksheet:

    The MainTestScript should be in following Format.

    This worksheet has 9 columns: Step, Browser, Page, UI Element, Action, Test Data, TableIdentifier, Comments and Severity. The Column name and their positioned should not bechanged.

    5.1.1. Step:

  • 8/6/2019 Automation Guide - V0.1

    6/15

  • 8/6/2019 Automation Guide - V0.1

    7/15

    5.1.6. Test Data / Data:

    The Input values are recorded in this column. In addition to the input values other keywordsare implemented to provide more flexibility in the framework. We can give test data accordingto our need.

    The Test Data is very important in testing an application.

    Test data is the Input feed for Testing the Application. To feed the test data to check that the outputs are derived correct. Test Data varied for different scenarios in testing (valid/invalid). While defining the Test data might be useful for other users/developers that what thesystem gave for the given inputs. Test Data help the developers to find the problem during fixes.

    5.1.7. Table Identifier:

    Main purpose of this field is to inform the system about important of a particular step asvalidation failed at this step, then the present testscript will be aborted and further processwould be terminated.The input value for this field could be either Blank or required.Default value is Blank. When value specified as required means it Mandatory i.e. validation

    should be pass at this step.

    5.1.8. Comments:

    Comments are general comments which are used by the QA person about a particular step.

    5.1.9. Severity:

    When any fail occur in application this field value specify the type of severity.It is of three type as follow:

    Critical

    Major

    Minor

    Which are refer as S1, S2 and S3 respectively.

  • 8/6/2019 Automation Guide - V0.1

    8/15

    5.2. Datapool:

    In the program we will fetch the dynamic value from the iteration no 1 without userinvolvement.

    A datapool is a test dataset, a collection of related data records which supplies data values tothe variables in a test script during test script playback.

    5.3. Iteration:

    Iteration refer repeating the same set of step again & again to fix number of times.When we will run the TestScript the sheet named MainTestScript will start executing step-by-step and when it will reach to the user action IterationStart that time the control goes tothe sheet named Iteration, and execute some set of steps and again come back to mainsheet

    The number of time the set of steps will execute will depend on the column value label asData user MainTestScript

  • 8/6/2019 Automation Guide - V0.1

    9/15

    5.4. Log Worksheet:

    The sheet name Log initially blank and filled at runtime step-by-step as the executionprogress.

    The main purpose of having Log sheet is to easily track the status of each track of the

    testScript.In below Figure we can see the it appear blank.

    Below Log (xls) filled step-by-step when testScript execution progress

  • 8/6/2019 Automation Guide - V0.1

    10/15

    6. Test Execution Flow:

    Following are steps to run the framework:

    1) Install java (jdk1.6.x)

    2) ANT(apache-ant-1.7.x)3) Set environment variable4) Start selenium server5) Run application

    Set environment variable

    1) Click on start button

    2) Right click on label My Computer

    3) Click last option i.e properties

    4) Click on tab label as Advanced

    5) Click on the button labeled as Environment Variables

    6) Click on the button labeled as Edit under system variables box and provide the

    following value one by one.

    variable name variable valueANT_HOME C:\apache-ant-1.7.0IATF_HOME C:\IATFJAVA_HOME C:\Program Files\Java\jdk1.6.0_14JAVA_LIB C:\Program Files\Java\jre6\lib

    Start selenium server:

    1. Start Selenium RC Server using command prompt.

    a) Open command prompt.

    b) Go to the directory where selenium-server. Jar is available in system

    c) Execute the following command

    java -jar selenium-server. Jar

    After that below window will display.

  • 8/6/2019 Automation Guide - V0.1

    11/15

    Run application:

    1) open command prompt

    2) Go to the directory where driver script available in your system

    3) Execute the following command:

    Java jar iatf.jar

    Application Run Mode

    The application under automation can be run in two different mode:

    1) Run/Unattended mode

    2) Debug/Attended mode.

    Launching a application in debug mode:

    Launching a program in debug mode allows you to suspend and resume theprogram, inspect variables, and evaluate expressions using the debugger.

  • 8/6/2019 Automation Guide - V0.1

    12/15

    To launch a Test Script/Java program in debug mode, first go to the ApplicationProperty ( eg C:\IATF\Properties\application.properties)Set the following variable value as follows:MODE_OF_RUN=A.

    Here A means Attended mode

    Example: When we will execute the Test Script in Debug/Attended mode,while running the Test Script if object is not found then system will ask the userfor their input as shown below:DO YOU WANT TO CONTINUE (Y/N) option if you press YThen it will ask from which step you want to continue the execution i.e.

    Enter StepNo ::if you say 2 then system continue start executing as per user input

    Launching a application in run mode:

    To launch a Test Script/Java program in debug mode, first go to the ApplicationProperty ( eg C:\IATF\Properties\application.properties)Set the following variable value as follows:MODE_OF_RUN=R.

    Here R means Run modeThe Run/Unattended mode is normal mode.

  • 8/6/2019 Automation Guide - V0.1

    13/15

    Test Report Analysis

    After the completion of the execution of the all scripts, system will generate one report whichare placed under result folder that consist of two type of details. Which are as follows:

    1) Summary Report.

    2) Detail Report.

    Summary Report:

    This part of the report consist of the following information:

    1) Build Information of the application2) Date of execution3) Total number of scripts run4) Application run on which all browser5) Scripts status like Pass/Fail/Abort based on browser6) Total scripts Pass/Fail/Abort on each browser

    7) Total severity like critical, major and minor8) Script status along with total number of fail if occur.

  • 8/6/2019 Automation Guide - V0.1

    14/15

    7.1. Test Report/Detail Report:

    Sheet Name: The value for this field display the testScript name along with the suffixwhich indicate the browser type(like FF,IE,CH,SF)

    Step: It display the step number of the scripts for which validation have beenpassed /Failed/Abort.

    Field : Display the element object of the application.

    Action: It will show which action Performed on the AUT.

    Expected Result: This value for this field hold the user expected value

    Actual Result: Actual value that system captured while validating the element Object

    during execution time

  • 8/6/2019 Automation Guide - V0.1

    15/15