test automation using

Upload: garima-mehra

Post on 24-Feb-2018

229 views

Category:

Documents


1 download

TRANSCRIPT

  • 7/25/2019 Test Automation Using

    1/83

    Softsmith Infotech 1

    Test Automation Using

    Selenium

  • 7/25/2019 Test Automation Using

    2/83

    Softsmith Infotech 2

    Test Automation

    Test automation is the use of softwareTo set test preconditions.

    To control the execution of tests.

    To compare the actual outcomes to predictedoutcomes.

    To report the Execution Status.

    Commonly, test automation involves

    automating a manual process already inplace that uses a formalied testingprocess!

  • 7/25/2019 Test Automation Using

    3/83

    Softsmith Infotech "

    #hy and #hen To Automate$

    %re&uent regression testing

    'epeated test case ()ecution is re&uired

    User Acceptance Tests %aster %eed*ac+ to the developers

    'educe the uman (ffort

    Test same application on multipleenvironments

  • 7/25/2019 Test Automation Using

    4/83

    Softsmith Infotech -

    Test Automation Tools

    .uic+ Test /rofessional 0y / 'ational %unctional Tester 0y 'ational I0 Company3 Sil+ Test 0y 0orland

    Test Complete 0y Automated .A .A 'un Compuware 3 #atir 4pen Source3 Selenium 4pen Source3 Sahi 4pen Source3

  • 7/25/2019 Test Automation Using

    5/83

    Softsmith Infotech 5

    Selenium

    Selenium is a ro*ust set of tools that supportsrapid development of test automation for we*6*ased applications!

    Selenium provides a rich set of testing functionsspecifically geared to the needs of testing of awe* application!

    Selenium operations are highly fle)i*le, allowing

    many options for locating UI elements andcomparing e)pected test results against actualapplication *ehavior!

  • 7/25/2019 Test Automation Using

    6/83

    Softsmith Infotech 7

    Selenium %eatures

    Supports Cross 0rowser Testing! TheSelenium tests can *e run on multiple*rowsers!

    Allows scripting in several languages li+e8ava, C9, // and /ython!

    Assertion statements provide an efficient

    way of comparing e)pected and actualresults!

    In*uilt reporting mechanism!

  • 7/25/2019 Test Automation Using

    7/83

    Softsmith Infotech :

    Selenium Components

    Selenium I;(

    Selenium 'emote Control Selenium

  • 7/25/2019 Test Automation Using

    8/83

    Softsmith Infotech =

    Selenium I;(

    Selenium I;( is an integrated developmentenvironment for Selenium tests!

    It is implemented as a %irefo) e)tension, andallows you to record, edit, and replay the test infirefo)

    Selenium I;( allows you to save tests as T>,8ava, 'u*y scripts, or any other format

    It allows you to automatically add assertions toall the pages!

    Allows you to add selenese commands as andwhen re&uired

  • 7/25/2019 Test Automation Using

    9/83

    Softsmith Infotech ?

    Selenium I;( Installation

    Using %irefo), first, download the I;( from theSelenium. downloads page #hen downloading from%irefo), you@ll *e presented with the #indow A! Seee)t Slide3

    Select Install ow! The %irefo) Add6ons window pops up,first showing a progress *ar, and when the download iscomplete, displays the #indow 0! See e)t Slide3

    'estart %irefo)! After %irefo) re*oots you will find theSelenium6I;( listed under the %irefo) Tools menu!

  • 7/25/2019 Test Automation Using

    10/83

    Softsmith Infotech 1B

    Selenium Installation

    #indow A #indow 0

    To run the Selenium6I;(, simply select it from the %irefo) Tools menu! It opensas follows with an empty script6editing window and a menu for loading, orcreating new test cases! See e)t Slide3

  • 7/25/2019 Test Automation Using

    11/83

    Softsmith Infotech 11

    Selenium I;( 6 UI

    Start and Stop'ecording

    SeleneseScript(ditor

    Selenium >og

    'eplayTool*ar

    AccessorArea

  • 7/25/2019 Test Automation Using

    12/83

    Softsmith Infotech 12

    Selenium 4ptions

    Selenium Options allow you to

    Set The Te)t (ncoding %ormat

    Set the ;efault /age Time 4ut

    Set The 0ase U'> recordingoption

    Adding Selenium Core and I;(()tension

    Add Automatic /age TitleAssertions

    There are also other optionsunder development

  • 7/25/2019 Test Automation Using

    13/83

    Softsmith Infotech 1"

    'ecoding a Selenium Test Case

    4pen %irefo) that has the I;( installed 4pen the *ase U'> of the application to record! eep the application in a common *ase state!

    format3

  • 7/25/2019 Test Automation Using

    14/83

    Softsmith Infotech 1-

  • 7/25/2019 Test Automation Using

    15/83

    Softsmith Infotech 15

    'unning Dour %irst Selenium Script

    a+e sure the application is in thecommon *ase state!

    Clic+ on the run *utton! ere you can alsocontrol the speed of the e)ecution usingthe tool*ar

    4nce the test is run you can view the testlog in the *ottom of the I;( window

  • 7/25/2019 Test Automation Using

    16/83

    Softsmith Infotech 17

    Creating a Test Suite

    In the Selenium I;( youcan create any num*er oftest cases and save themas test suite!

    To 'un the test Suite clic+on the E/lay entire testsuiteF *utton as shown*elow!

    Test Suite withTest1 G test2

  • 7/25/2019 Test Automation Using

    17/83

    Softsmith Infotech 1:

    /laying The test Suite with Test'unner

    Test 'unner allows you to run the test case in a *rowser

    loaded with the Selenium6Core Test'unner! Test runner is invo+ed *y clic+ing the *elow Shown

    *utton in the I;(

    4n Clic+ing the Test 'unner 0utton you will thewindow as seen in the ne)t slide

  • 7/25/2019 Test Automation Using

    18/83

    Softsmith Infotech 1=

    Test 'unner

    Clic+ this *utton to run all the tests

  • 7/25/2019 Test Automation Using

    19/83

    Softsmith Infotech 1?

    'unning 4ptions

    'un a Test CaseClic+ the 'un *utton to run the currently displayed test case!

    'un a Test SuiteClic+ the 'un All *utton to run all the test cases in the currently

    loaded test suite!Stop and StartThe /ause *utton can *e used to stop the test case while it isrunning! The icon of this *utton then changes to indicate the'esume *utton! To continue clic+ 'esume!

    Stop in the iddleDou can set a *rea+point in the test case to cause it to stop on aparticular command! This is useful for de*ugging your test case!To set a *rea+point, select a command, right6clic+, and from theconte)t menu select Toggle 0rea+point!

  • 7/25/2019 Test Automation Using

    20/83

    Softsmith Infotech 2B

    'unning 4ptions

    Start from the MiddleDou can tell the I;( to *egin running from a specificcommand in the middle of the test case! This also isused for de*ugging! To set a start point, select a

    command, right6clic+, and from the conte)t menuselect SetHClear Start /oint!

    Run Any Single Command;ou*le6clic+ any single command to run it *y itself!This is useful when writing a single command! It lets

    you immediately test a command you areconstructing, when you are not sure if it is correct!Dou can dou*le6clic+ it to see if it runs correctly! Thisis also availa*le from the conte)t menu!

  • 7/25/2019 Test Automation Using

    21/83

    Softsmith Infotech 21

    Adding Assertions to the Script

    Selenese allows multiple ways of chec+ing for UIelements!

    erifications and assertions are used to chec+ if

    an element is present somewhere on the page$ specific te)t is somewhere on the page$

    specific te)t is at a specific location on the page$

    erifications and assertions are not one and the

    same! If an assertion fails, the script will *e a*orted *ut

    if a verification fails the script will continue!

  • 7/25/2019 Test Automation Using

    22/83

    Softsmith Infotech 22

    erification Commands

    verifyTextPresentThis command is used tochec+ if a particular te)t ispresent in a page or not!

    To add this command , #hile

    recording the test steps rightclic+ on the te)t item that youwant verify! 4nce right clic+edyou can find an option EShowall commandsF! 4n Clic+ing ityou will find an option

    EverifyTe)t/resentF, select it

  • 7/25/2019 Test Automation Using

    23/83

    Softsmith Infotech 2"

    erification Commands

    verifyTitle This command is used to

    chec+ if the page title iscorrect or not!

    To add this command , #hile

    recording the test steps rightclic+ any where on the pagethat you want verify! 4nceright clic+ed you can find anoption EShow all commandsF!4n Clic+ing it you will find an

    option EverifyTitleF, select it

  • 7/25/2019 Test Automation Using

    24/83

    Softsmith Infotech 2-

    erification Commands

    verify(lement/resent This command is used to verify

    if a page element is present inthe page or not!

    To add this command ,#hile recording the teststeps right clic+ anyelement on the page thatyou want verify! 4nce rightclic+ed you can find an

    option EShow allcommandsF! 4n Clic+ing ityou will find an optionEverify(lement/resentF, selectit

  • 7/25/2019 Test Automation Using

    25/83

    Softsmith Infotech 25

    erification Commands

    verifyalue This method is used to chec+ if

    edit *o) has particular value orif the chec+ *o) is on!0asically this method returnsthe value of present in theo*Ject!

    To add this command , #hilerecording the test steps rightclic+ any element on the pagethat you want verify the value

    of! 4nce right clic+ed you canfind an option EShow allcommandsF! 4n Clic+ing it youwill find an option EverifyalueF,select it!

  • 7/25/2019 Test Automation Using

    26/83

    Softsmith Infotech 27

    Assertions

    Assertions are same as erifications!The only difference is, if the assertionsfail the script will a*ort! 0ut the script

    will continue run in case a verificationpoint fails!

    The steps for inserting the assertions is

    same as that of verification point! #hile recording 'ight Clic+ Show allcommandsselect an assertion!

  • 7/25/2019 Test Automation Using

    27/83

    Softsmith Infotech 2:

    Assertion Statements

    assertTextPresent

    This will assert if the te)t is present in the page!

    assertText

    This will assert if a particular element is having the particular te)t!

    assertTitle

    This will assert if the page is having a proper title!

    assertValue

    This will assert if a Te)t *o) or chec+ *o) has a particular value

    assertElementPresent

    This will assert if a particular UI (lement is present in the page!

  • 7/25/2019 Test Automation Using

    28/83

    Softsmith Infotech 2=

    Selenium #ait%or Commands

    wait%or/ageTo>oadThis command will ma+e the script to wait till the

    page loads!

    Synta) is wait%or/ageTo>oadtimeout3K Time out isthe ma)imum time the script will wait for the pageto load!

  • 7/25/2019 Test Automation Using

    29/83

    Softsmith Infotech 2?

    4ther wait%or Commands

    wait%orAlertThis command will wait for the alert message to appear

    wait%orTa*leThis command will wait for the #e* ta*le to completely

    load in the pagewait%orTitle

    This command will for the page Title to appear on the*rowser!

    4ther wait%or commandsSelenium has several other wait command li+ewait%orTe)t, wait%or/opup and so on! These commandsare generically called Synchroniation commands

  • 7/25/2019 Test Automation Using

    30/83

    Softsmith Infotech "B

    Store Commands

    Store command are used to fetch thevalues from the application and store it ina varia*le! These varia*les can *e used

    latter for validation purpose!

    The Store command can *e used toretrieve the page title, te)t from the page

    and other attri*utes from the application!

  • 7/25/2019 Test Automation Using

    31/83

    Softsmith Infotech "1

    (cho Command

    (cho command isused to print the valuein to the selenium I;Slog!

    #hen printing avaria*le use LMvarN

    There are some

    limitations for thismethods this has to *eused with caution

  • 7/25/2019 Test Automation Using

    32/83

    Softsmith Infotech "2

    >imitations of Selenium I;(

    Can run the test only on %irefo)

    o /rogramming login li+e loops,conditional statements3 can *e applied

    Selenium I;( can e)ecute scripts createdin Selenese only!

    It is difficult to use Selenium I;( forchec+ing comple) test cases involvingdynamic contents

  • 7/25/2019 Test Automation Using

    33/83

    Softsmith Infotech ""

    Selenium 'C

    A solution to cross *rowser testing!A server, written in 8ava and so availa*le

    on all the platforms!

    Acts as a pro)y for we* re&uests fromthem!Client li*raries for many popular

    languages!0undles Selenium Core and automatically

    loads into the *rowser

  • 7/25/2019 Test Automation Using

    34/83

    Softsmith Infotech "-

    Installing Selenium 'C

    Software 'e&uired 8; 1!7 , selenium6remote6control61!B!" this can *e

    downloaded from httpOHHseleniumh&!orgHdownloadH3

    Installation /rocedure Selenium 'C is simply a Jar file and to run it we need

    Java installed! 8; 1!7 is preferred3

    4nce the 8ava is installed Just unip the selenium6

    remote6control61!B!"! ip which was downloaded fromthe selenium site to a directory!

    http://seleniumhq.org/download/http://seleniumhq.org/download/
  • 7/25/2019 Test Automation Using

    35/83

    Softsmith Infotech "5

    Selenium Test Automation /rocess

    %irst

  • 7/25/2019 Test Automation Using

    36/83

    Softsmith Infotech "7

    Selenium Test Automation /rocess

    4nce the Selenese script is converted into yourpreferred language you can you can run themusing Selenium Server!

    %or running the script you also need the clientdriver for that particular language!

    To enhance the script we will re&uire I;( li+enet*eans or (clipse I;(

    To Integrate the script and run them as a suitewe will re&uire *uild integration tools li+e avenor Ant!

  • 7/25/2019 Test Automation Using

    37/83

    Softsmith Infotech ":

    ow Selenium #or+s

  • 7/25/2019 Test Automation Using

    38/83

    Softsmith Infotech "=

    'unning a Selenese Test on;ifferent 0rowsers

    %ollowing are the steps to create a selenese test suiteand run a test suite using selenium 'C

    13 'ecord a test case using selenium I;( and save it as ETest1!htmlFsay3!

    23 'ecord another test case using selenium I;( and save its asETest"!htmlF say3!

    "3 In this way you can record any num*er of test case using seleniumI;( and save them as PfilenameQ!html

    -3 Then Create a ew Test Suite using the %ile enu! See the Image0elow!

  • 7/25/2019 Test Automation Using

    39/83

    Softsmith Infotech "?

    Selenese Suite cont!!

    Add the created test cases in to the suite as shownin Image1

    4nce the test cases are added to the suite savethem as a test suite as in Image2

    The 4pen the command prompt and navigate to

    the directory where Selenium 'C server3 isplaced!

    In the command prompt (nter the command asshown *elow!

  • 7/25/2019 Test Automation Using

    40/83

    Softsmith Infotech -B

    Selenese Suite cont!!

    Command O Java 6Jar selenium6server!Jar

    6multiwindow 6htmlSuiteRie)ploreR

    RhttpsOHHlocalhostH*oo+storeHRR;Otesta!htmlRRCOresults!htmlE

    4nce the command is run theresults will *e stored in the

    results!html file as shown*elow!

  • 7/25/2019 Test Automation Using

    41/83

    Softsmith Infotech -1

    Selenium Test Case ;evelopmentUsing 8ava

    'e&uired Software

    Selenium 'C Server Jar , Selenium 8avaClient ;river Jar , 8; 1!7 , (clipse orany other I;(3, 8unit Jar and testng Jar

    %or *uilding the frame wor+ we re&uirecontinuous *uild integration tools li+e Ant,aven or cruise control!

  • 7/25/2019 Test Automation Using

    42/83

    Softsmith Infotech -2

    Client ;rivers

    (na*les communication with Selenium 'emote ControlServer!

    %unctionality of Selenium is e)posed via these drivers!Availa*le in 'u*y, /ython, 8ava, C6Sharp Vand so on!

  • 7/25/2019 Test Automation Using

    43/83

    Softsmith Infotech -"

    /rocess of ;eveloping Selenium8ava Scripts!

    %ollowing are the steps for generating the

    test scripts in Java

    13 'ecord the Script in Selenium I;( andformat them into 8ava

    23 Create a Selenium 8ava proJect in(clipse and load all the necessary Jar

    files"3 Copy the formatted 8ava code into the

    (clipse and run the test!

  • 7/25/2019 Test Automation Using

    44/83

    Softsmith Infotech --

    %ormatting the recorded script into8ava

    Steps of formatting the code into Java

    13 4pen the 0rowser and open the*ase U'> of the application!

    23 4pen the Selenium I;( and start

    recoding the test steps!"3 4nce the recording is done go to

    enu 4ptions %ormat 8avaTest

  • 7/25/2019 Test Automation Using

    45/83

    Softsmith Infotech -5

    Setting Up an (clipse /roJect forSelenium Automation

    (clipse is an open source community whose proJects arefocused on *uilding an e)tensi*le development platformfor *uilding 8ava applications and framewor+s! (clipse isone of the *est 8ava I;( and as a matter of face (clipseis much more than a 8ava I;(!

    #e can configure a selenium proJect in eclipse and evenrun the scripts from eclipse!

    Using eclipse its easy to enhance the recorded script!#e can add power to the recorded script *yparameteriing the test inputs and even validate the

    *ac+ values! (clipse also allows us to write reusa*le code for efficient

    test automation!

  • 7/25/2019 Test Automation Using

    46/83

    Softsmith Infotech -7

    Installing (clipse

    ;ownload the E(clipse I;( for 8ava ;evelopersF fromthe httpOHHwww!eclipse!orgHdownloadsH page!

    Unip the downloaded ip file from the a*ove site into adirectory!

    4nce the unipping is over open the folder and dou*leclic+ on the icon and it will open a dialog *o) asshown *elow!

  • 7/25/2019 Test Automation Using

    47/83

    Softsmith Infotech -:

    Setting up the wor+space

    Create a folder say selenium3 in any one of thedirectory and change the wor+space location tothe directory created *y you! Then clic+ o+*utton!

    4n doing so you will see the eclipse welcomescreen if you are doing it for the first time! 4n thewelcome screen clic+ on the wor+*ench icon toopen the proJect e)plorer!

    #hen you to try to open the eclipse from ne)ttime it will directly show the proJect e)plorer asshown in the ne)t slide!

  • 7/25/2019 Test Automation Using

    48/83

    Softsmith Infotech -=

    (clipse I;(

    /ac+age()plorer Scrip iew

    console

  • 7/25/2019 Test Automation Using

    49/83

    Softsmith Infotech -?

    Create a /roJect In eclipse

    %ileew8ava/roJect

    Specify the proJect nameand clic+ finish

  • 7/25/2019 Test Automation Using

    50/83

    Softsmith Infotech 5B

    Adding the re&uired 8ars

    4pen the folder contain the selenium proJect that youhave Just created! Inside that folder create another folderwith name Eli*F

    Inside the li* folder place the following Jar files!

    Junit6-!=!1!Jarselenium6Java6client6driver!Jarselenium6server!Jar

    testng65!12!Jars

    After placing the Jar file in li* come *ac+ to the eclipse

    and clic+ on the proJect e)plorer strip and press %5! Doushould see the all the Jar files under the li* folder in theproJect e)plorer as shown in the Image in ne)t slide!

  • 7/25/2019 Test Automation Using

    51/83

    Softsmith Infotech 51

    Selenium >i*raries

    C ti + d ddi

  • 7/25/2019 Test Automation Using

    52/83

    Softsmith Infotech 52

    Creating a pac+age and adding aclass file

    In the eclipse/ac+age()plorerright clic+ onthe src source3 folder! Inthat select ew/ac+age and give a name

    to the pac+age! See the/icture1

    ow right clic+ on thecreated pac+age and clic+on newclass and

    provide a class name! Douwill see a Java scripttemplate as seen in thene)t slide

    ( li I;( ith 8 S i t

  • 7/25/2019 Test Automation Using

    53/83

    Softsmith Infotech 5"

    (clipse I;( with 8ava ScriptTemplate

    Dour I;( should loo+ li+e this

    This is where you have copy the8ava code that you formatted in the

    Selenium I;(

    Addi th 8 fil t th l

  • 7/25/2019 Test Automation Using

    54/83

    Softsmith Infotech 5-

    Adding the 8ar files to the classpath

    'ight Clic+ on the/roJect

    Select 0uild /ath

    Configure 0uildpath

    4n the ne)t window

    clic+ on the li*rariesta* and clic+ on theadd Jars ta*

    Addi th 8 fil t th l

  • 7/25/2019 Test Automation Using

    55/83

    Softsmith Infotech 55

    Adding the 8ar files to the classpath

    As you clic+ on the addJars *utton a windowshowing all the Jar files

    will *e opened! Selectall the Jar files and clic+on o+ *utton

    0y doing this step we

    are almost ready towrite the script and runit!

    C ti th t t i t i id th

  • 7/25/2019 Test Automation Using

    56/83

    Softsmith Infotech 57

    Creating the test script inside theclass file

    Copy the code that was formatted in theselenium I;( and paste it in the (clipseI;( script template!

    a+e sure the class name that youcreated and the class name in the scriptare same

    a+e sure that you have add the methodssetUp and tear;own

  • 7/25/2019 Test Automation Using

    57/83

    Softsmith Infotech 5:

    'unning the test through (clipse

    Start the Selenium Server %or this open the command prompt and go to the folder

    where the selenium server is present! 'un the command EJava 6Jar selenium6server!JarF

    The Selenium server will start running and you can seethe message in the command prompt!

  • 7/25/2019 Test Automation Using

    58/83

    Softsmith Infotech 5=

    'unning the test through (clipse

    4nce the server is up go to the eclipse and right clic+ onthe script!

    In that select 'un As8Unit Test! See the image *elow!After this you will get will see that the script has runsuccessfully in the window that@s shown in the ne)t slide!

    Selenium 'esults Strip in the

  • 7/25/2019 Test Automation Using

    59/83

    Softsmith Infotech 5?

    Selenium 'esults Strip in the(clipse I;(

    success

    failure

    Components of the Selenium test

  • 7/25/2019 Test Automation Using

    60/83

    Softsmith Infotech 7B

    Components of the Selenium testScript

    setUp method

    This method prepares the selenium server to run thetest! This method *asically hoo+s to the selenium serverand opens up the *ase U'> of the application

    test methodThe methods with the name test will actually run thetests on the application! There can *e any num*er of testmethods in the app

    tear;own methodThis method will run after the end of the test! This testwill disconnect with the server and ma+es room for thene)t tests to run the tests!

  • 7/25/2019 Test Automation Using

    61/83

    Softsmith Infotech 71

    Script iew

    (nhancing the Selenium

  • 7/25/2019 Test Automation Using

    62/83

    Softsmith Infotech 72

    (nhancing the Seleniumcommands

    The generated selenium command can *eenhanced *y writing Java commands!Using Java methods we can do

    parameteriation and data *ase validation!ore over Java methods can *e used forto perform some comple) validations andtesting activities!

    The *est way to use Java methods is usedto is have a 8ava I;( li+e eclipse!

  • 7/25/2019 Test Automation Using

    63/83

    Softsmith Infotech 7"

    Some 8ava 0asics

    ava !ata Types

    Int, float, String, char, 0oolean and dou*le

    !e"larationsString s X ESeleniumFKInt i X 2BK

    float cur X "!"5K

    Operators ,H ,Y ,, 6are themathematical operators ,H, Y,have a higher

    precedence than or 6

  • 7/25/2019 Test Automation Using

    64/83

    Softsmith Infotech 7-

    'elational 4perators

    XX (&ual careful3

    ZX ot e&ual

    QX ess than or e&ual

    Q ess than

  • 7/25/2019 Test Automation Using

    65/83

    Softsmith Infotech 75

    /rogramming (lements

    #f Conditionif (name != selenium)

    {

    System.out.print(Tool Changed);

    }

    lse

    {

    System.out.print(Tool is o);

    }

    $oop n timesfor i X BK i P nK n 3

    MHH this code *ody will e)ecute n timesHH I from B to n61N

  • 7/25/2019 Test Automation Using

    66/83

    Softsmith Infotech 77

    Use string functions

  • 7/25/2019 Test Automation Using

    67/83

    Softsmith Infotech 7:

    ;ate %unctions

    'e&uired /ac+ages

    importJava!util!;ateK

    importJava!te)t!Simple;ate%ormatK

    Sample Code

    ()ample 1

  • 7/25/2019 Test Automation Using

    68/83

    Softsmith Infotech 7=

    ()ample 1 W F is present in it

    Implementation Steps13 %irst get the values from the list *o)

    23 To get the values from the list *o) or any

    other T> element we need to +now its[path! use [path chec+er3

    "3 The values ta+en from the list *o) arestored in a varia*le!

    -3 Use the inde)4f method to find if ET>Fis present in the e)tracted varia*le!

  • 7/25/2019 Test Automation Using

    69/83

    Softsmith Infotech 7?

    Screen Shot of the ()ample Script

    [path >ocator

  • 7/25/2019 Test Automation Using

    70/83

    Softsmith Infotech :B

    /arameteriation

    /arameteriation is to same run the script withmultiple set of data!

    The data will *e stored in a CS file! #e will have write a program to read the values

    from the e)cel line *y line and replace thevalues!

    %or reading the values from a CS file we willre&uire the following pac+ages

    import Java!io!%ileK import Java!io!0uffered'eaderK import Java!io!%ile'eaderK import Java!util!StringTo+enierK

    /arameteriation ()ample

  • 7/25/2019 Test Automation Using

    71/83

    Softsmith Infotech :1

    /arameteriation ()ample

  • 7/25/2019 Test Automation Using

    72/83

    Softsmith Infotech :2

    Ant Integration

    Ant is a free tool from the Apache 8a+arta i+e \ma+e@ for 8ava W only *etter Uses an [> file to drive its action

    ()tremely powerful and modular

    (asily e)tensi*le #ritten in 8ava so it is cross platform

  • 7/25/2019 Test Automation Using

    73/83

    Softsmith Infotech :"

    To Integrate with AT

    ;ownload AT and copy it into any of thedirectory

    Create a 8AA]4( environment aria*le

    Create a AT]4( environment varia*lesAdd the AT *in path to windows path

    environment varia*le

    Create a *uild file to load all the Jar files andcreate targets to run the selenium tests usingthe *uild file

    ;efining a folder Structure for

  • 7/25/2019 Test Automation Using

    74/83

    Softsmith Infotech :-

    ;efining a folder Structure forSelenium AT tas+

  • 7/25/2019 Test Automation Using

    75/83

    Softsmith Infotech :5

    'unning the AT selenium tas+

    Start the selenium server through the commandprompt

    Then go the folder where the selenium tests arestored

    a+e sure that the *uild!)ml file is present inthat location

    ow run the command EantF from the command

    prompt Dou can see the test running and the results will

    *e saved in the results!t)t file!

    Selenium-Grid

  • 7/25/2019 Test Automation Using

    76/83

    Softsmith Infotech :7

    Selenium Grid

    Selenium-Grid allows the Selenium-RC solution to

    scale for test suites or test suites to be run in multipleenvironments.

    With Selenium-Grid multiple instances of Selenium-

    RC are running on various operating system andbrowser congurations, each of these when launchingregister with a hub. When tests are sent to the hubthey are then redirected to an available Selenium-RC,which will launch the browser and run the test.

    his allows for running tests in parallel, with theentire test suite theoretically ta!ing only as long to runas the longest individual test.

  • 7/25/2019 Test Automation Using

    77/83

    Softsmith Infotech ::

    ow to

  • 7/25/2019 Test Automation Using

    78/83

    Softsmith Infotech :=

  • 7/25/2019 Test Automation Using

    79/83

    Softsmith Infotech :?

    ow to 'un

    In a new terminal enter the followingcommand

    ant launch6remote6control

    0ased on your target file you can runeither in se&uence or in parallel

    #h ^ d$

  • 7/25/2019 Test Automation Using

    80/83

    Softsmith Infotech

    #hat^s good$

    'elatively easy to automate we* UI tests

    'ecordH'eplay for regression tests

    'C allows integration with CI and8UnitH%itesse tests

    #h t^ * d$

  • 7/25/2019 Test Automation Using

    81/83

    Softsmith Infotech

    #hat^s *ad$

    SpeedO 'C6Q0rowser communication is aspeed *ottlenec+ run in grid, overnight3

    UI is *rittle, tests depending on the UI

    *rea+ a lot ;ST> might fi) this, pagea*stractions as well3

    ;ata6*ac+ed tests are not easily

    repeata*le integrate with ;0 test engines3

    0 t ti

  • 7/25/2019 Test Automation Using

    82/83

    Softsmith Infotech

    0est practices

    Use Selenium to verify wor+flow andsession

    ;on^t put Selenium tests in your main

    development *uild W run them overnight ave dedicated machines that run tests

    !O'(T T)#'* O+ T)#S AS A

    REP$ACEME'T +OR E,P$ORATOR-TEST#'.///

    >i +

  • 7/25/2019 Test Automation Using

    83/83

    >in+s

    httpOHHgoJ+o!net httpOHHwww!open&a!org

    httpOHHwww!solutionsi&!comHagile2BB=Hagile62BB=6domain!php

    httpOHHstorytesti&!solutionsi&!com httpOHHwww!cu*ictest!com

    httpOHHfitnesse!infoHwe*test

    http://gojko.net/http://www.openqa.org/http://www.solutionsiq.com/agile2008/agile-2008-domain.phphttp://www.solutionsiq.com/agile2008/agile-2008-domain.phphttp://storytestiq.solutionsiq.com/http://www.cubictest.com/http://fitnesse.info/webtesthttp://fitnesse.info/webtesthttp://fitnesse.info/webtesthttp://www.cubictest.com/http://www.cubictest.com/http://storytestiq.solutionsiq.com/http://storytestiq.solutionsiq.com/http://www.solutionsiq.com/agile2008/agile-2008-domain.phphttp://www.solutionsiq.com/agile2008/agile-2008-domain.phphttp://www.openqa.org/http://www.openqa.org/http://gojko.net/http://gojko.net/