Qa Training in Virginia | Software Testing Courses Online USA



Automation testing: whatever testing we were doing manually if we do the same thing with either scripting language or any programming languageWhy we are going for automation testing???With help of this automation testing we can execute more number of test cases within less timeNow a days in order to perform automation testing they were n no of automation tools among which most of the people were going for either QTP or SeleniumWhat are the differences between QTP and Selenium???QTP: licensed softwareIE browserWeb based and window basedSelenium: open source toolIt supports record and playback featureIt supports multi browser : IE, FF, Chrome etcMulti programming language feature: java, ruby, phyton, .net etcIt also support cross OS testingWeb based applicationWhen can we go for automation???If the application is of big size(total number of test cases)Frequent releasesBehaviour/ functionality remains constant for all the releasesAssume your application contains 1000 test casesFrequent releases: per month :every month and for each and every release they were adding a new functionality or module to the application so that total number of test case will increase from release to release inorder to execute 100 test cases it takes 10daysJuly : 1st release: 3 modules : 300Test cases : 30days Aug: 2nd release: 1 new module(100TCs) + 300TCs(regression items) : 10days + 30daysSept: 3rd release : 1module(100TCs) + 400Tcs(regression items) : 10days + 40Oct: 4th release: 1module(100TCs) + 500Tcs(regression items): 10 days + 50Finally inorder to execute the regression items within less time we are going for automation testing with the help of any automation toolIn the 1st release if I click on 1 link it redirects to page1 so in my test script I have added a verification related to page1 In the 2nd release if I again clik on the 1 link it redirects to page1 only then only whatever the scripts I have prepared will execute successfully else my script will failWhen can we cant prefer automation testing???If the application is of small sizeIf the application behaviour or functionality keep on changing for release to release in such cases we used to go for manual testing onlyAssume that your application contains 50Tcs only then we will go for manual testing only why because inorder to automate those test cases it requires 5 to 6 days but within these days we can finish manual testingIntroduction to seleniumInorder to automate web based application across multiple platform we are using this selenium test toolAs selenium is an open source tool we can download this from selenium official websiteMultii browser support: IE, FF, safari, chromeMulti programming language feature: java , .net, ruby, phytonCross OS testing Cross browser testing : similar test case in IE, FFComponents of selenium or flavours in selenium Selenium IDESelenium RC v1.0WebDriver v2.0Selenium GridEach and every component has its own significance of course limitations alsoSelenium IDE: it supports record and playback feature( this feature is similar to that of QTP record and playback feature)Record and playback feature: : whatever actions we were performing in the browser selenium IDE will capture the scripts for those actions and whenever it was required we can execute those prepared scriptsLimitations:It was restricted to FF browser means selenium IDE is an addon to firefox browser means whatever actions we were performing in the FF browser those things only captured by selenium IDE and other browser actions were not captured by selenium IDEWe cant implement if condtions, while loop and multiple window handling and advanced concepts(split commands)As selenium IDE contains these limitations most of the people were going to selenium RC or webdriverSelenium RC or WebDriver: we are implementing multiple browser and multi programming language featureIt means whatever test case we have prepared in selenium Rc or webdriver we can execute that test case in any browser(IE,FF, chrome etc.)We can choose any one of the programming languages to write our selenium RC or webdriver code : java, ruby, phyton , .netJAVA as their programming language: in our classes we will see selenium RC and webdriver using javaIn order to work on selenium means we need to know any much about java if we know the basics in java we can simply write our selenium RC or webdriver code and even in our classes we wil see the required concepts in java alsoTestplan document: v1.0, 1.1,1.2,1.3If we made any major modification to that document then we can change that version as v2.0, v3.0By simply looking into the versions we can understand that both RC and webdriver were one and the same but there exists small difference between these two so we need to know what is the difference between these 2Java BrowserIt means we are writing oour code in java and we are executing that code in the browsers(IE, FF etc)How can the programs written in java will work on browser???Selenium server plays a major role in the RC and as well webdriver it acts like a barrier or mediator between browser and programming languageFor RC: we need to start this selenium server manuallyFor webDriver: we no need to start this server manuallySelenium grid: cross OS testing, cross browser testingHow can we overcome few of the limitations in selenium IDE Location of objects concepts we are getting the various kinds of properties associated to an object and we are giving those properties to our selenium script inorder to identify that object in the webpageSelenium IDEIDE: Integrated Development Environment: this is an addon to firefox browser only whatever actions we were performing in the firefox browser corresponding code is generated by selenium IDE if at all we are performing actions in other browser like IE, Chrome selenium IDE wont record any scripts as it is an addon to FF browser onlyAdvantage: it supports Record and playback feature How can we install this selenium IDE to firefox browser???Steps:Open the firefox browser and open google home pageIn the search field enter selenium IDE free download and click on search buttonAmong those search results click on 1st link which is “Download Selenium IDE” link which will redirect us to selenium official website downloads pageFrom this page we can download the selenium IDE, RC, WEbdriver as of now we need to download selenium IDE . simply click on the link which is 2.2.0 or(2.2.1 or 2) It will display a confirmation message saying that firefox was prevented this site do you want to continue simply click on allow buttonAfter few seconds it wil display a new window where we need to click on install button and after few seconds selenium IDE installed to the browser and it is asking us to restart the browser simply click on restart nowHow can we confirm whether selenium IDE was installed or not???Steps:Goto FF browser >> under Web Developers > we can find Selenium IDE >> simply click on that selenium IDE >> it needs to display a new windowFew options in Selenium IDE:Record option: at the extreme right end of the selenium IDE window and below the close button we can find one “Red button” which we call it as a record button using which we can either perform the record action or else we can stop recordingBy default that button is in enabled mode it means whatever actions we were performing in the browser selenium IDE will capture the scripts, we can change the status of the button by simply clicking on that buttonWhenever the selenium IDE was in recording mode then only it will capture the script else it wont capture the script for the actions whatever we were performing in the browserScenario1:prepare a simple script using selenium IDE record option “ open , enter some value in search field click on search button”Steps:Open selenium IDEAnd verify whether selenium IDE was in recording mode or not??, if it is in non recording mode then click on that automatically the selenium IDE will moves to recording modeThen go to the browser and perform some actions in the browserCome back to IDE click on stop recording and verify whether some script got generated by Selenium IDE or notHow can we execute the recorded script??? Or playback feature???So by simply clicking on this button we will execute the recorded script. Before executing the script open a plan new tab in the browserSoon after I clicked on the play current test case button whatever actions we have recorded those things will be executed in the browserExecution mode in Selenium IDE ??? generally with this option we execute our test case in either fast mode or normal mode or slow mode, by default this one was in fast modeGenerally in the starting stage we usually execute our test cases in slow mode why because if the test case is executing in the slow mode we can understand what action it is performing in the browserBefore clicking on play current test case button we need to select this mode of executionHow to save this test case??? Goto file >> save a test case >> give a valid name for that test case with an extension .htmlScenario 2 for your practise: prepare a selenium IDE script for google. Com, sugar CRM and try to execute the same script11th july 2013:The commands in selenium IDE was broadly categorised into 3types they were:Command, target, valueCommand: the action what we were performing which we call it as a commandTarget: we need to specify on which object we were performing this action(this object location is a major scenario)Value: assume that we were supposed to enter some value in the bing search field that value will be entered in this fieldBut if we have a look into the captured selenium IDE commands for few commands it contains all the 3 fields, for few commands it contains only 2 fields and for few commands it contains only 1 field alsoFor which commands all the 3 fields will be there and for which commands only 2 fields will be there and for which commands only 1 field will be there we need to knowintroduction to locators, why we are going for locator what is the use of locatorsexample: assume that in a class there were 10 people and we want to identify a single person among those 10 people. By default we can identify any person with his name, if we were unable to identify a person with his name means then we will go for some other identification to catch that person among those 10 people.Name, height, wight, color : these are the various kinds of properties for an human being similarly inorder to identify an object in the webpage that object contains various properties like id, name, class, value, type, xpath, css, link it means developer while developing the application he will assign unique properties to the objects…Each and every thing in the web page like buttons,title, links, text fields, checkboxes etc we call all these things as an objectsHow can we get the various kinds of object properties???With the help of firebug addon to the firefox browser we can see the various kinds of properties for an object and value associated for those properties How can we install this firebug addon to firefox ???This installation is similar to that of selenium IDE installationSteps:Open FF browser and open google home page In the search field enter “Firebug addon for firefox browser” and click on search buttonAmong the search results click on “ Firebug Addon for Firefox” which will redirects to firbug official website Where in that page we can find one option which is” add to firefox” simply click on that buttonSimply click on install now button automatically firebug got installed to the browserHow can we confirm whether that firebug got installed or not???2 ways:Simply right click on the browser and observe the options it is displayingsometime it will display as Inspect Element at the extreme right end of the browser we can find thisHow can we see the various properties for an object???Steps:Simply right click on that object for which we want to identify the properties and select inspect element with fire bug Then a small window will open which will contains the various kinds of properties associated to an objectThe most important which we need to know is “ for every object it may contains any one of the above listed properties or all the properties”How can we identify an object with its properties???Syntax:Property type= property valueWe can this property type and property value from firebug onlyExample:Id= sb_form_goPlace the above syntax in selenium IDE target field and click on find buttonIf at all we found this error message in selenium IDE means simply change the object property and try to identify that objectExample: if 2 persons with the same name how can we identify???Then in such cases we usually go for another unique property the same thing will be applicable for web objects.If at all we were unable to identify any object in the webpage with the default properties then we will go for either xpath or cssSyntax://tagname[@property type=’property value’]Tagname also we can get this from firebug only : Example: //input[@type='submit']The purpose of both xpath and css are one and the same but the syntax is some what differDescriptionXpathCSS???to identify an object with id propertyinput[@id='id value']css=input#idvaluewith nameinput[@name='name']css=input[name='name']with classinput[@class='classname']css=input.classnamewith valueinput[@value='value']css=input[value='value']with multiple propertiesinput[@value='value' and @type='tupevalue']css=input[value='value'][type='typevalue']Purpose of checking these properties???Whenever we perform simple recording in Selenium IDE it will automatically capture the object properties and if we move to selenium RC or webdriver or in IDE we need to write our code in java where we need to specify these properties it means on which object it needs to perform the actionOverview of xpath and css also??: clearHow can we identify links in a web page???: inroder to identify links in a web page we have 3 different methodsWith the link name which is link=link nameExample: > text < link=Imagesthese two concepts were implemented with the help of xpath conceptWith the entire text present on that linkSyntax://tagname[contains(text(),’text present on that link’)]Example://a[contains(text(),'Test Channel Administrative Interface')]With starting text present on that linkSyntax://tagname[starts-with(text(),’starting text present on that link’)]Example://a[starts-with(text(),'Test')]If in the webpage there were 2links with the same starting text whether this will work??? We need to add some more text Test channel administrative interfaceTesting applicationProprtytype= property valueSyntax: Link=linknameContext menu??? : Scenario: prepare a simple script for login to applicationWe recorded one small script for login scenario which contains 3 steps they were entering uid, pswd and clicking on login button. Eventhough passing invalid credentials to my script my test script will always show as a success one why because whatever the actions we specified there as it is performing those actions it will show it as a passed one only..So now we need to modify our test script according based on the application it needs to change the execution status as a passed or failedWith the help of context menu we are doing such thingsWith the help of this context menu we are adding verification points to our selenium IDE script.Where can find this context menu???Once after we opened selenium IDE and simply right click on the browser at the last we can find “Show All Available commands”The context menu was broadly categorized into 5sets:OpenAssertVerifyWaitforstorethe suffix was broadly categoried into 4sets:text presenttitleelement presenttextThe purpose of both assert and verify is one and the same these two were used for verification purpose it means whether something is there or not we can confirm with this assert or verifyAssert: it is an mandatory verification point, if that verification point is there in the webpage then only it will continue the remaining commands execution else it will fail the script and stop the script execution at that command onlyVerify: is an non mandatory verification point, if that verification point is not there in the webpage then it will fail that command only and it will continue the remaining script executionWaitfor: this will stop the selenium IDE script execution for something or for sometime.How much time this waitfor will stop the selenium IDE execution???Generally whenever we used waitfor command in selenium IDE means it will stop the script for 30secs=30000msecsSelenium IDE >> options >> click on optionsAssume that your application response time is 80secs, then in such situation my selenium IDE script will fail, how can I execute my script successfully means simply enter the desired timed out and click on ok button automatically from the next time onwards it will wait for 90secsStore: inorder to store something in a variable we are using this store command and inorder to store some information present in a browser to a variable we are using this store commandExample: int a=5, String b=”murthy”Textpresent: it will verify a specific text in the entire webpage, but it won’t consider how many times that text was there in the webpage but it only checks whether at least once it was there or notTitle: inorder to check the webpage title we are using this commandElementpresent: it will checks the existence of the objects in the webpage it means it will verify whether a specific object is there or not in the webpageText :it will verify a specific text at a specific locationScenario: lets prepare two scripts one with assert and another with verify by using all the above 4 conceptsFew commands in selenium IDE: but inroder to work on selenium IDE if we know few commands then we can simply work on IDE and RC as well why because the commands which we are using in IDE are same in RC also.Verify, assert, click, clickandwait, waitfor, store, check, uncheck, pause, select, echo, select and wait, goback,refresh,gobackandwait, refreshandwait, open,highlightClick: this command will clicks on any link or button in the webpageClickandwait: click + waitforpagetoload it wil simply click on any link and it will wait until the webpage got reloadedCheck: inorder to check a checkbox we are using this commandUncheck: inroder to uncheck a checkbox we are using this commandSelect: to select a value from the dropdownSelectandwait: select + waitforpagetoloadGoback: it will moves to the previous pageGobackandwait:Refresh: it will refresh the current webpagePause: to stop our selenium IDE script execution for few secondsThe purpose of pause and waitfor both are one and the same but the usage is differExample: assume that we thought our application will open the home page after 80secs it means the page loading time is 80secs, so I already upated the default timeout to 80secs and in my script I used couple of waitfor commands. If the webpage got loaded within 20secs then waitfor continue the remaining commnds execution where as pause will strictly stop the execution for the specified timeWhy we are discussing all the below concepts means as of now we are preparing selenium IDE scripts with only record option but it we know the below concept then we can write our own script in selenium IDECommands which contains all the three fields command, target, value:Text, ?type ,(Store—comes under different category), selectText: it wil verify specific text at a specific locationCommand: verifyText,AssertText,waitfortext,storeTextTarget: object locationValue: the text we were verifyingType: it will enter some value at a particular locationCommand: typeTarget: object location where we want to enter the valueValue: which value we want to enter into the search fieldStore: to store a value in a variable Command: storeTarget: which value we want to save will give here (5)Value: in which variable we are saving that (a)Int a=5Select: inorder to select a value from the dropdownCommand: select/selectandwaitTarget: the dropdown location object locationValue: which value we want to select from the dropdownCommands which contains command and target:Elementpresent, Textpresent, title,Click, check, uncheck,highlight, open,pauseelementPresent: it will verify whether the object is there or not in the webpagecommand: verify/assert/waitfor/storeElementPresenttarget: object locationtextPresent: to verify a specific text at a specific locationcommand : verify/assert/waitfor/storeTextPresenttarget: the text whatever we are verifyingtitle: to verify the title of the webpagecommand: verify/assert/waitfor/storeTitletarget: title of the webpageclick: inorder to click on links or buttoncommand: click/clickandwaittarget: object locationuncheck/check: to check/uncheck a checkbox command: uncheck/checktarget: object locationhighlight: to highlight an object on which we were performing the actionscommand:highlighttarget: object locationopen: it will open the specified URLopen base URL+ Absolute URLbase URL: we wil place this one below the file optionabsolute URL: we will paste this one in the targetCommand: openTarget: / abosulte UR if the application dosent contains any URL then simply “/”Pause: to stop script execution for few seconds or specified timeCommand: pauseTarget: how much time you want to stop the scriptCommands which contains only command field:Goback, refresh, gobackandwait, refreshandwaitCapturing of screenshots using selenium IDE:Selenium IDE has one command using which we can capture the screenshots which is “captureentirepagescreenshot”How this command will work means wht I need to fill in command , target, value:Command: captureentirepagescreenshotTarget: location with what name and with what extension I want to save that screenshotValue : is an optional we can leave as blank also or sometimes we wil give field as Backgroud#=FFFFFFWhat is a start point and break point???Example: assume that your test script contains 100+ lines of code, and while executing the script unfortunately the script got failed at 60th command still we need to execute around 50 commands , and we no need to execute the above 60 commands we simply need to execute the remaining commands is there any way to execute our test case from the middle???Yes , we can execute any test case in Selenium IDE from the middle of the execution by keeping start point.Start point: we are asking Selenium IDE to start executing the test script from the start point only instead of executing from the 1st commandHow can I set this start point???2 ways inroder to set this:simply right click on the command on which you want to place the start point and you can find one option which is “Set/ Clear start point”simply place the cursor on the command and type “s” in the keyboard automatically start point will be createdIf the start point is there in selenium IDE then scrip execution will start from the start point when I clicked on play current test case button else it will start executing the script from the 1st command itselfBreak point: at this particular point the script execution will stopHow to set this break point???2 ways inroder to set this:simple right click on the command select “Toggle Break Point” place the cursor on the command and simply type “b” in the keyboardHow can I stop my selenium IDE Script for few seconds???WaitforPauseManually also we can stop the script executionHow can we stop my script execution manually:Besides the play current test case button we have one more button which is pause/resume button which is in disabled modeUsually when I started executing my test case in selenium IDE this button will comes to enable modeIf I again click the same button it wil continue the remaining commands executionStep button in selenium IDE:By default this button is also in the disabled mode like pause/resume button and when we started the test script execution and if I click on pause button then this button will comes to enable modeAnd now lets try to execute the test case and click on pause button and observe the status of this step buttonWhat is the use of this step button??Once after we paused our script execution if at all we want to execute the script in the command we are going for this option it means the command wise execution is possible with this step buttonExample: assume that we opened a firefox browser in which I logged into my application and in I closed that tab without logout from the application and in the new tab if I open the gmail application it wont ask any credentials it will directly login to the application so whatever the script we have prepared that will fail , how can I execute my test script without any failures???The reason behind the failure as we already logged into the application the credentials were saved in the browse cookiesHow can I execute my test case successfully with failing that one means???2 options Simply delete all the browser and then continue your script execution it means 1st command in selenium IDE must be delete cookies command and then we need to add the remaining commandsCommand: deleteallvisiblecookiesTarget, value: no targetWe can simply write an if condition Limitations:We can’t implement if conditionsIt was restricted to FF browserWe cannot handle multiple windows, alerts and few of the advanced concepts so because of this reason most of the people were going to RCBut how can we overcome those limitations means how can we implement if conditions in selenium IDE, multiple window , alerts , some kind of advanced concepts inIDEAssume that this is your hard disk size 200GB, but still we want to store some personal information then what we are doing we are connecting external hard disk to our laptops so that whatever the information we want we can save that information in that hard disk and whenever it was required we are getting that information from the hard disk itselfThe conclusion from the above point is even though my system is not capable to store additional information I am adding external hard disk to store that information, similarly as selenium IDE contains too many limitation we are adding one user extension to selenium IDE which will overcome the limitations in IDEUser extension file contains the code related to that of few of limitations present in IDE, so that whenever we are adding that file to our IDE means it is simply overcoming those limitationsWhat exactly this user extension file contains: this file is a set of java script functions, means whatever the limitations of selenium IDE were in this file it contains a java script code for that limitation, so when I added that file to IDE means it is simply overcoming that limitationFrom where can we get this file???I already prepared this file and I will share this to youHow can we add this to our selenium IDE???Options >> options >> selenium core extension user extensions >> >> simply click on browse button it will display a new window using which we can select the user extension file and click on ok buttonSimply restart your selenium IDEHow to perform the logic scenario using if condition???Steps:Open the applicationI will implement a simple if condition where we will check for logout link it means if the logout link got displayed means we already logged into the application, so we can skip enter uid, pswd and clicking on login button, we can simply print one confirmation message to the log that “we already logged into the application” Else if logout is not there in the webpage means simply enter uid, pswd and click on login button and print a confirmation message that “successfully logged into application”Command: gotoifTarget: specify the conditionValue: desired logic it means if the above condition was true then what exactly it needs to doEcho: is the command supported by Selenium IDE using which we can print some values to the logCommand: echoTarget: the value which we want to printTest case execution in the selenium IDE was of sequential mode it means once after completion of 1st command then it will execute 2nd and after 2nd command it wil move to 3rd like that…Even though the echo command is writing some information to the log as the information is displaying in the same black colour that is really bit difficult for us to identify the confirmation messageSo to avoid such things I am going or log.warn method to print some confirmation messageCommand: getEvalTarget: we need to specify log.warn(“desired message”)getEval: it will evaluate/execute the expression present in the targetso here with the help of LOG.warn we asked IDE to print that message as an warning message to the log that’s why it displayed in red colourhow can we create multiple users in selenium IDE???Steps:1st of all identify how many users u want to create then store the starting user value in a variable and the ending user in another variableExample: test1, test2, test3,… test50X=1, y=50: start limit and end limit for user creationWhenever we are entering userid there simply call the value present in x variableSimply increment x value by 1 Compare this x value with y value like until this x value is lessthan y value create usersExample:X=1, y=50Test1X=1+1=22<=50Test2X=2+13<=50Test3X=x+1=4Test4…X=50Test50X=50+151<=50(false) it will simply skip the user creationHow can we call a value present in a variable ${variable name}Test51, test52, test53… test55X=51Test5151+1=> 5252<=55( it is true )Test5252+15353<=55(it is true)Test5353+15454<=55(true_Test5454+15555<=55(true)Test5555+15656<=55(false, simply stops the user creation)Test50, test55, test60, test65, test70.. test100Dynamic number: means : su124238734, su47654672567,su3543219, su6546275Is it possible for us to create a dynamic number for user creation???Yes, we can create or generate a dynamic number using the java script functions and the logic related to that function was already there in our user extension file, where is the function how can we see that function, so lets open the user extension filefunction generateAccountName(prefix) { var suffex = formatDate( new Date, 'yyMMddHHmmss'); return String(prefix).substring(0,2) + suffex;}Using above function we can generate a dynamic number so lets see how this function will workyyMMddHHmmss 130722062210,130722032212whenever we are calling this function this will generate a value based on the current system time, as the time will change for each and every seconds so this function also wil generate a value dynamically so I can simply use this function for dynamic user creationString(prefix).substring(0,2) from the prefix take 1st 2 charactersgenerateAccountName(‘murthy’){var suffex=130722032212mu130722032212mu130722032230}Command: storeTarget: javascript{ generateAccountName('murthy') }Value: userid(variable name)How can we call this function in selenium IDE???As of now this function is generating a value so lets store this value in a variable, so the command I need to give as store and now in the target we need to call that function, as it is an javascript function simply start with javascript and function name in the targetSplit command:Example: Once after we filled and submitted the user registration form the application will generate a dynamic userid likeSuccessfully created user and your userid is test5286Successfully created user and your userid is murt hy896Successfully created user and your userid is krish2757In order to login to the application we must require that userid , if we are testing the application manually then by looking into thr application we can get the userid and we will simply enter the uid. But how come we will get the uerid from the entire string using selenium IDE, with the help of split command using java script scenarios we are separating the given stringFrom the sugar CRM application the text present on the link is “Krishna Krishna” so let’s try to split this text.When we are discussing about context menu we observed that some kind of store commands were there in context menu and the objective of those commands is it will store the information present in the browser to a variable Multiple window handling in selenium IDE:Example: whenever we are working on one window and if we click on any link it will open a new page, how can we will perform actions on the new pageSo if it possible for us to switch to new window and to perform actions on the new window, yes we can do this one using selectwindow command in selenium IDEIt means whenever we were working on any window eventhough it will open multiple windows, but the selenium IDE script execution was on the 1st window only , if we want to switch to another window means I need to use selenium window commandCommand:selectwindowTarget: specify the unique property related to that windowValue: not requiredHow can we get the window unique property???As we know that in context menu we have one command using which we will verify the title of the webpage so by using that title command from context menu get the title of the newly opened window and specify it in the target of select window commandAlerts handling in selenium IDE???How we are handling the above confirmation messages using selenium IDEWe are simply handling these kind of confirmations using “assert confirmation“Command: assertconfirmationTarget: we need to specify the message present on the screenValue: not requiredFor few of the applications selenium IDE will capture this confirmation messages , lets try to implement the same on our current applicationSteps performed In the application:We selected that checkboxGoto the dropdown and select a value from the dropdownThen confirmation message got displayed handle that messageScript recorded:Selected the checkboxIt is searching for confirmation messageIt is selecting a valueIf we observe the difference between the steps we performed and script recorded the order of 2 and 3rd got changed in the script, let us try to execute the script and see whether the script is executing successfully or it is failing. Conclusion is script got failed so the reason is ass we know that order is changed so simply rearrange that order, now test script execute successfullyIf we wont add this assert confirmation command to selenium IDE then it will display below error message to the logAs of now with this command it is clicking on ok button but I don’t want to click on ok button if I want to click on cancel button then which command we need to use???We have few commands in selenium IDE using which we can either click on ok button or else cancel button but we are not handling such kind of scenarios in selenium IDE inorder to handle those scenarios we were going for either RC or webdriverCommand: chooseokonNextconfirmationTarget: we need to specify the confirmation Test suite: group of test cases if we save them in an order we call it as an test suiteWhat is the use of this test suite???Example: we prepare 6 scripts in selenium IDETest1: login to appTest2: create userTest3: logout from app Test4: login to app as an created userTest5: verify the user privillagesTest6: logout from the app as an userHere from the above we can say that we need to execute the test cases in the same order to achieve the functionality, once after preparing the test cases I haven’t saved this order and simply I closed my selenium IDE, once again if I open my selenium IDE then the order was not ther so in order to execute that scenario means we need to frame all the cases in that order and then only we can execute our scenario successfully, so now we need add the order , and ofcourse unfortunately I forgot to save order of test cases again means when I need to perfrom this scenario I need to arrange test cases 1st and then only I can execute then so instead of arranging testcases these many time once we prepared the order simply save the order of test case executionFile >> save Test SuiteIt wil open a similar window how we are saving a test case so give a valid name for the test suite .html and click on ok button.Close the selenium IDE and reopen that one goto open test suite option and select the test suite which we created and if we observe in IDE it will display the same order how we saved themGenerally in real environment how can create suites means simply create a test suite for each and every module or sub moduleFramework in selenium IDE:In order to implement a specific task if at all we are following some kind of rules and regulations which we call it as a framework.Example: assume that there were 10people working for a project in an organisation, and each and every person is having a different exp in selenium , so whenever all the 10people writing the scripts means all need to follow some rules while automating the applicationThe basic rules followed by most of the people were:Save the test cases with a valid name, so that by simply looking into the case anyone can understand the scenario of that test caseWhatever the variables we are creating try to save them with a proper naming convention and even for the test suites also give a valid namePrepare an understanding document for the automated projectWhat is an understanding document???Once after someone finished the automation he will prepare an excel sheet in which he will mention the variables which we need to change before executing the test caseWhy we need to prepare this understanding document???Example: assume that I am working for one organisation and I prepared automation test scripts for one project and after an year I left from that organisation, unfortunate a new person assigned to work on that project, as he don’t know how I created the script and which variables used and all those things it leads confusing to that person, so to avoid that one we are preparing the understanding document once after completion of the project it means in that document we will specify which variables need to change before executing the script and the objective of each and very test script so that by simply looking into that document anyone can understand that automation scriptsLimitations in selenium IDE???It was strictly restricted to FF browserOnce after test case execution was finished it is not generating any report for the test resultsEven though we implemented I conditions but it is some what confusingIn order to overcome the limitations present in selenium IDE we are going to selenium RC(Remote Control)Multiple window handlingAlerts handlingTest suiteframeworkScenarios for practise:15th july: Scenarios for your practise: try to prepare test scripts for assert and verify for the sugar CRM application, google, bing application16th July:Scenario: write a script to enter a value in username field, pswd field and click on login button and verify whether we were logged into application or not17th July:Scenario: try to write own script for selecting value in the Dropdown, check a checkbox and uncheck a checkbox for Scenario: write a script for login to CRM application using deleteall visible cookies command18thJuly:Scenario: prepare a script for login scenario using a simple if condition Scenario: create 10cotacts or 50 contacts for sugar CRM using if conditionScenario: generate a dynamic number and create multiple users using If condition 22nd july:Scenario1: try to prepare test scripts for handling multiple windows**************************************************************Selenium RCAdvantages of selenium RC:It supports multiple browsers means a single test case we can execute in IE,FF, chromeIt supports multiple programming languages like java,.net, ruby, phyton etcAs we are choosing a programming language we can simple implement conditional statements and looping statementsWe are choosing java as our programming language in order to write our selenium RC test casesIf we know the basic concepts in java then we can simply work on Selenium RC and the basic concepts like variable declaration, program syntax, if condition implementation, and inheritance conceptFor writing programs in java we are choosing eclipse editor ( using this eclipse java developer will writes his java code)How can we write our selenium commands in java editor???How we are implementing if conditions in selenium IDE means by adding user extension file to selenium IDE we are overcoming the limitation of selenium IDE, the same way we are adding 4 jar files to eclipse editor so that we can write our selenium commands in eclipse editorWe need to add 4 jar files to eclipse editorWhat are those 4 jar files and from where can we get them???Each and every jar file has its own significance Selenium server jar file: it acts like a barrier or mediator between programming language and the browser which contains application under test, it means it will help to execute the prepared in the browser(IE,FF,chrome)Selenium java client drivers: as eclipse is a purely java editor so how can I write my selenium commands in eclipse editor so we are adding this jar file so that we can implement all the selenium related commands in eclipse editorHow to download above 2 jar files:Open google home page and in the search field enter selenium server download It wil display the results if we click on the 1st link it will redirect us to the same page where we have downloaded the selenium IDE and from this page we can download 1st 2 jar files which is selenium server and selenium java client driversSoon after I clicked on the save button that selenium server file will get downloaded to our downloads folder in our local machineIn the same page we can find client drivers options so from which as we are working java programming language click on that java it wil ask us to save click on save buttonAs of now the selenium java client drivers is downloading as a zip folder so after download try to unzip that folderJunit jar file: in order to write some junit test cases in eclipse editor we are using this jar fileSteps to download this jar file:Open the below url on the automatically Junit jar file will be downloaded to our machineJxl jar file: with the help of this jar file only we can implement the data driven testing in selenium RCSteps to download this jar file:Open google home page and in the search field enter jxl jar free download OrOpen this url directly : the page to the end and we can find below optionAutomatically that jxl.jar file got downloaded to our downloads folder now we need to extract that folder So once after downloading all the jar files try to create a new folder and name that folder as “Library” in which place all the jar files whatever we have created , whatever the jar files we have downloaded copy all thosethings and paste them in this folderWe need to download the eclipse editor as well and its version is >3.5Open the below url : download the eclipse editor and even this editor will download as a jar file so try to extract that jar filehow can I open my eclipse editor???Once after we downloaded the eclipse and extracted go that folder Simply double click on the above highlighted globe symbolWhatever test script we were preparing in the eclipse we are selecting a location save those test scripts using this workspace launcherSimply select a location and click on ok button automatically it will display eclipse editorHow can I add all these jar files???Create a new project >> file >> new >> others >> And last click on finish button so whatever the name we have given with that name a new project got created JRE System Library: this folder contains various kinds of jar files related to javaRight click on SRC >> build path >> configure build pathClick on that one which will display a new window where move to the libraries tab and select external jar filesIt will open a new window where we need select the created jar filesSimply click on ok button, it will create a new folder and the name of the folder is Referenced libraries which contains all the jar files How can we write a simple test case in selenium RC???Steps:Create a new package and give a proper name to that packageRight click on SRC >> new >> package >> give a proper name and click on ok buttonIt will open a new window in which enter a valid name and click on ok buttonAnd if you observe the project the sample folder got created to our SRCCreate a new java class to the newly created packageRight click on the created package >> goto new >> class >> click on ok buttonIt wil display a new window where we need to enter a proper name and check the public static void main check boxAnd at last click on finish buttonObject means any real time entity we can it as an object , laptops , mobile, human beings alsoclass means collection of these objects we call it as a class Example: we were planning to construct a house, before constructing a house we used to prepare a plan ( means how much space we have in which how many rooms we were planning etc) which we call it as a class and once after the house was constructed as we can see that one which is a real time entity we call it as an objectSyntax of class:Class classname{Stmt1;Stmt2;Stmt3;}What is the use of this public static void main: with the help of this method only we can execute our code which was written in java it means if our java class contains this method then only we can execute that class else we cant execute that classSyntax:Public static void main(String args[]){}This is the main method to our java class, so whatever the commands we have written here we can execute those commandsHow can I prove that one means???Simply right click on the class whatever we have created as it is java class goto runas option if the class contains main method then it will display java application else it wont displayAs we created a java class now lets try to write a sample java in java class for opening an applicationThe various selenium commands we have were open, type, select, click we cannot write these commands directly in java the way how we have implemented in IDE inorder to write commands in RC means we need to follow some syntax As we already added the required jar files to the entire project now we need to call all those required jar files in the current test case, as we no all the selenium related commands we there in selenium java client drivers jar file, so try to call that one here and using which we can use the selenium related commands hereIn java we can create an object to that class and using that object we can access the various kinds of commands present in that classSyntax of creating an object to normal class is:Classname objectname=new classname(); Syntax for creating an object to defaultselenium class is:DefaultSelenium selenium=new DefaultSelenium(p1,p2,p3,p4);What are these P1,p2,p3,p4: these are all the parameters we need to pass while creating an object to the defaultselenium classP1: on which machine we were executing the test cases or else on which machine we were executing these commands, if we are executing ion our local machine then we need to give this one as “localhost”, if we are executing this script on virtual machine or remote machine we need to specify that machine name and in majority of the cases we usually give this parameter as localhost only and we need to pass this one in double quotes as this a stringP2: on which port our selenium server is running by default the port number is 4444 and this is of integer type means we no need to enter this one in double quotesP3: on which browser you want to execute your current test case *firefox, *iexplorer,*googlechrome as this of string type I need to pass this one in double quotesP4: on which URL it is similar to that of base url in selenium IDE it means on which application we were executing this test scripts we need to mention here as it is of string type we need to enter value in double quotes ex:” ” “ ”Once we implemented this syntax in our test script it is displaying an error message the reason is we added the required jar files to the entire project but we need to add them to our test cases, place our cursor on that error message it will display some kind of import commands simply click on importSimply click on the 1st link then the error message will disapperInorder to import the required packages to our current test case we have 2 methods the 1st method is above one by simply placing the cursor and 2nd method is “ctrl+sift+o” automatically the required packages will be importedAs we already created an object to the defaultselenium class with that object name . we can access the various kinds of commands in selenium, krishnatrainingusa@Sugar CRM application:URL: : KrishnaPswd: Krishna ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download