Selenium topic 1- Selenium Basic
-
Upload
itprofessional-academy -
Category
Software
-
view
341 -
download
2
Transcript of Selenium topic 1- Selenium Basic
Slide 1
Copyright 2015 IT Professional Academy1Automation (Selenium) Testing CourseWELCOME
1IT Professional Academy
Copyright 2015 IT Professional Academy2About IT Professional AcademyTeam of Highly Skilled Trainer with work Exp of 7+Y.
Expertise in areas like Software Testing, Big Data, Linux-Unix, SAP BI as well as Software Development.
Provides both Classroom and Online Classes.
Training centers across multiple cities.
Provides Job Assistance, Interview preparation, Mock Interviews, Resume Preparation.
2IT Professional Academy
Copyright 2015 IT Professional Academy3Salient Features:
3IT Professional Academy
Copyright 2015 IT Professional Academy4About Trainer:Exp: 7+ Y in Automation Testing
Technical Expertise:Selenium, QTP, Mobile AutomationBatch Intro.
4IT Professional Academy
Copyright 2015 IT Professional Academy5Demo AgendaCourse ContentIntroduction to Software TestingIntroduction to Automation TestingIntroduction to Selenium WorldIntroduction to HTMLIntroduction to Objects and Methods.Introduction to Selenium IDERecord and Play Back in Selenium IDE
Copyright 2015 IT Professional Academy6Course ContentIntroduction to Automation TestingIntroduction to SeleniumSelenium ComponentsConfiguration Of IDE and Dev ScriptsIntroduction to Eclipse and JunitSelenium Web DriverValidations\AssertionsAdvance InteractionsFramework DevelopmentData Driven TestingTestNG FrameworkSelenium Gridhttp://www.itprofessionalacademy.in/selenium.php
http://www.itprofessionalacademy.in/selenium.phpIT Professional Academy
6
Copyright 2015 IT Professional Academy7Batch ExpectationsWhat are your Expectations with this course?
Copyright 2015 IT Professional Academy8Introduction To Software TestingPurpose of Software Testing: To get Quality Product with out exceeding the set Cost.Live Example: Bank Lost $10000k in a month due to a defect.
Methodologies in Testing: Water fall Vs Agile
Software testing Life Cycle.
Copyright 2015 IT Professional Academy9Software Testing: Water Fall Model
IT Professional Academy
9
Copyright 2015 IT Professional Academy10Agile: Focus on MVP
IT Professional Academy
10
Copyright 2015 IT Professional Academy11Testing Pyramid: Agile
IT Professional Academy
11
Copyright 2015 IT Professional Academy12Testing Pyramid: AgileAs testing is mostly done at the bottom, Developer and Tester should Speak the Same language.
Ability of the tool for integration with the Unit tests.
And Selenium has that ability.
Minimum at the top, most at the bottom. Selenium works well with the approach.
IT Professional Academy
12
Copyright 2015 IT Professional Academy13Introduction To Automation TestingAutomation is the use of tools and strategies that reduce human involvement or interaction in repetitive or redundant tasks.
IT Professional Academy
13
Copyright 2015 IT Professional Academy14Need for Automation Testing?Bottom Line:So that machine works while you sleep so as to save
TIME&MONEY.Budget is the Driving Factor for all automation efforts.
IT Professional Academy
14
Copyright 2015 IT Professional Academy15Need for Automation Testing?ROI Example:
ROI = Benefit/Cost
Simple Rule: If Number of Automation Tester is more than Number of Manual Tester then ROI is not as Achieved.
IT Professional Academy
15
Copyright 2015 IT Professional Academy16Automation ROIROI= Benefit/Cost
If green line is not getting constant, ROI will never be achieved.IT Professional Academy
16
Copyright 2015 IT Professional Academy17Before you Automate..Ask two questions:
1. Shall you Automate?Should get some value out of it.Automating Flow which will only be used once should not be automated. Having said that, automating a flow which will be used only once but is important and not possible manually; should be automated.
2. Can you Automate?Check Automation feasibility.Before committing, always check if flow or AUT is feasible to automate. Do not false commit.
IT Professional Academy
17
Copyright 2015 IT Professional Academy18
But this is water fall. Old Approach.IT Professional Academy
18
Copyright 2015 IT Professional Academy19Advantages & Disadvantages of Automation TestingAdvantagesDisadvantagesSaves TimeHigh Investment in Tool and trainingCost ReductionTest CoverageReliable: Eliminating human errorHigh man power requirement for test preparations.ReusableBetter Quality Software
IT Professional Academy
19
Copyright 2015 IT Professional Academy20Criteria For Automation Test ToolScopeEase of IntegrationCompatibilityPerformanceTypes of testsMaintainabilityAffordability
IT Professional Academy
20
Copyright 2015 IT Professional Academy21QTP Vs Selenium-1
QTP: It is commercial tool and hence it requires a license is expensiveSelenium: Its an open source tool hence it does not require license and is freeQTP: It is used for testing client-server applications. It can test web- based as well as desktop applicationsSelenium: Using Selenium only web applications can be testedQTP: QTP tests can only be developed in QTP IDESelenium: Selenium has the option of using wide range of IDEs like Visual Studio, Eclipse, NetbeansQTP: HP UFT only supports VB scriptSelenium: Selenium supports JAVA, .NET, Ruby, Perl, PHP, and many other programming languages
IT Professional Academy
21
Copyright 2015 IT Professional Academy22QTP Vs Selenium-2
QTP: HP UFT comes with built in object repository. Object repository development and maintenance is quite easy in HP ALMSelenium: Selenium dose not have such built in object repository, but object can be managed by using UI element user extensionQTP: HP UFT integrates with test management tool like HP Quality CenterSelenium: There is no such tool that integrates with SeleniumQTP: All types of dialog box is supported by itSelenium: It supports dialog box partiallyQTP: It supports different environments like SAP, Oracle, .NET but user need to purchase add-on license for themSelenium: It supports addition of plug-ins to include features that are not provided by core Selenium
IT Professional Academy
22
Copyright 2015 IT Professional Academy23QTP Vs Selenium-3
QTP: Automation testing is expensive due to licensing costSelenium: Web automation testing with Selenium incurs less costQTP: HP QTP offers very good technical supportSelenium: It has no official support, since it is an open sourceQTP: HP QTP supports only VBScript . Hence Object Oriented Approach to Test Automation becomes challengingSelenium: Selenium supports mature Object Oriented Language like JavaQTP: HP QTP is more user friendly and scripts are developed quickly.Selenium: It is a low level tool with less functionality. Script requires more time to develop and maintainQTP: Backward compatibility is powerful. Latest version of HP ALM supports code that was developed 5 years backSelenium: With new Selenium release the API changes. So Test Scripts need to be updated
IT Professional Academy
23
Copyright 2015 IT Professional Academy24QTP Vs Selenium-4
In Short it is similar to Buying a Laptop
QTP: Laptop with Windows 10 and useful Applications installed. Every thing up and Running.
Selenium: Laptop Case + Hard Disk+ Ram+ Linux CD + useful Applications CD. But Every thing for Free and Highly customizable Set Up.
IT Professional Academy
24
Copyright 2015 IT Professional Academy25Introduction to SeleniumSelenium overviewSelenium LandscapeSelenium ComponentsDifferences between Selenium and QTPModern Day BrowsersMaintainabilityAffordability
IT Professional Academy
25
Copyright 2015 IT Professional Academy26Introduction to SeleniumSelenium automates browsers. Thats it. What you do with that is entirely up to youPrimarily it is for automating web applications for testing purposes, but is certainly not limited to just that.Selenium has the support of some of the largest browser vendors who have taken steps to make Selenium a native part of their browser.It is also the core technology in countless other browser automation tools, APIs and frameworksSelenium provides an easy to use record and playback IDE in addition to client API which Unleash the full power of an Object oriented automation framework.Selenium is an open source framework which cost nothing.Selenium has full integration with commonly used IDEs like Eclipse etc.
IT Professional Academy
26
Copyright 2015 IT Professional Academy27Selenium LandscapeSupported Browser:Google Chrome, IE, Opera, Firefox, Safari
Supported OS:Windows, Linux, iOS, Android
Supported Languages:Java, C#, Ruby, Python, Perl, PHP, JavaScript
IT Professional Academy
27
Copyright 2015 IT Professional Academy28Modern Day Browser Usage:
IT Professional Academy
28
Copyright 2015 IT Professional Academy29Selenium ComponentsSelenium IDE: Mozilla Platform
Selenium 2/ Web Driver: Java Platform
Selenium Grid: Java Platform
Selenium RC: Part of Selenium 2/Web Driver
IT Professional Academy
29
Copyright 2015 IT Professional Academy30HTML BasicsTypes of Control:Text ElementsText BoxLinksTableRadio GroupSelect ListDrop downCheck BoxButtonsHoversTooltips
IT Professional Academy
30
Copyright 2015 IT Professional Academy31Object and MethodsEvery thing is an Object.All Objects has properties and methods/functions.
I am an Object:Properties:1. Name: Akash2. Age: 34 3. DNA: ATCG4. Weight: 80KGAnd many more..Actions I can DoType(what to type)Dance(which dance)Sing(which song)And many more
IT Professional Academy
31
Copyright 2015 IT Professional Academy32Object and MethodsAll Objects has Parent.
I am an Object:Properties:1. Name: Akash2. Age: 34 3. DNA: ATCG4. Weight: 80KGAnd many more..Actions I can DoType(what to type)Dance(which dance)Sing(which song)And many more
I am an Object:Properties:1. Name: Akash_Dad2. Age: 603. DNA: ATCG_14. Weight: 75KGAnd many more..Actions I can DoRead(what to type)
And many more
IT Professional Academy
32
Copyright 2015 IT Professional Academy33Object and Methods
I am an Object:Properties:1. id: gs_htifo2. class: gsfi3. background-color: transparent and many moreActions I can DoType(Selenium)Clickand many more..
GoogleInput Box
IT Professional Academy
33
Copyright 2015 IT Professional Academy34Target-Command-Value-Sync-VerifyAll interactions are the combination of :
1. Target2. Command3. Value4. Sync5. Verify
Analogy: Paint- This Wall- With Red Color-wait for it to Dry-Verify
IT Professional Academy
34
Copyright 2015 IT Professional Academy35Selenium IDEThe Selenium-IDE is the tool you use to develop your Selenium test cases.Easy to use Firfox (only) plug inRecord and Playback capabilitiesContext menu for UI Elements SelectionSelenese Command referenceNot only a time-saver, but also an excellent way of learning Selenium Script syntax.Free and open source.Only for R&D; not a full fledged automation FW.
Minimum at the top, most at the bottom. Selenium works well with the approach.
IT Professional Academy
35
Copyright 2015 IT Professional Academy36Selenium IDE
Minimum at the top, most at the bottom. Selenium works well with the approach.
IT Professional Academy
36
Copyright 2015 IT Professional Academy37Selenium IDEAll step are the combination of :
1. Command2. Target 3. Value
Analogy: Paint- This Wall- With Red Color
IT Professional Academy
37
Copyright 2015 IT Professional Academy38Selenium IDE3 Types of Commands:
1. Actions: Commands that directly interacts with page elements.
2. Assessors: Store values to a variable.
3. Assertions: Verify if a certain command is met.
IT Professional Academy
38
Copyright 2015 IT Professional Academy39Selenium IDEExamples:
Actions: Click, Type
2. Assessors: storeTitle, store
3. Assertions: assert, verify, waitForTitle
http://parabank.parasoft.com/parabank/index.htmIT Professional Academy
39
Copyright 2015 IT Professional Academy40Selenium IDEHow to Identify Locators:
There are multiple ways to identify an Object or Target or Locator:
By idBy nameBy XPATHBy Link TextBy CSSBy DOM
http://parabank.parasoft.com/parabank/index.htmIT Professional Academy
40
Copyright 2015 IT Professional Academy41Selenium IDEHTML Representation:Enter your Name
By id = id="payee.name"By name = name="payee.name"
By XPATH = //input[@id = payee.name]Or //input[@id = payee.name and containsText() = Enter your Name]
http://parabank.parasoft.com/parabank/index.htmIT Professional Academy
41
Copyright 2015 IT Professional Academy42Selenium IDEExample By id, name, xpath:Google Search Box: Locate by id= gs_htif0;name=q;xapth=//div[@id='gs_lc0']/input
http://parabank.parasoft.com/parabank/index.htmIT Professional Academy
42
Copyright 2015 IT Professional Academy43Selenium IDEExample: Record ScriptDemo Site: http://parabank.parasoft.com/parabank/index.htm
Script1: ValidateLoginFunctionalityScript2: CheckBillPaymentFunctionality
IT Professional Academy
43
Copyright 2015 IT Professional Academy44Selenium DAY 2
Hands On IDE
IT Professional Academy
44
Copyright 2015 IT Professional Academy45Verify And AssertVerify will continue execution.Assert will halt execution in case of failues.
IT Professional Academy
45
Copyright 2015 IT Professional Academy46Other Imp CommandstypetypeAndWaitassertTextPresentassertTextNotPresentpauserefreshwaitForPageToLoadstoreLocationstoreTitleCheck, uncheckmouseOver, mouseOut, mouseOverAndWaitstoreSelectedIndex, storeSelectedIndexesassignId, captureEntirePageScreenshotstoreSelectOptions, storeValueBreak,goBackverifyAlert, assertAlert.
IT Professional Academy
46
Copyright 2015 IT Professional Academy47Other Imp CommandsAssert: Execution will Verify, But stops if verification failed.
IT Professional Academy
47
Copyright 2015 IT Professional Academy48StoreText and StoreTextPresent
"storeText" command is useful to store text value of page element in to variable for future use"storeTextPresent" command is not for storing value of any target element, but it is useful to verify thatspecified target text is available on page or not.
IT Professional Academy
48
Copyright 2015 IT Professional Academy49Store and Echo
Store: Is used to Store value in a variable. Once stored can be used across multiple tests in Run Session.Echo: To Print the value.
IT Professional Academy
49
Copyright 2015 IT Professional Academy50Clip Board Format
open/parabank/index.htmtypename=usernamejohntypename=passworddemoclickAndWaitcss=input.buttonstoreText//table[@id='accountTable']/tbody/tr[12]/td[2]/btotalAmmountecho${totalAmmount}After copying the Rows in the IDE.
IT Professional Academy
50
Copyright 2015 IT Professional Academy51Clip Board Formatdriver.get(baseUrl + "/parabank/index.htm"); driver.findElement(By.name("username")).clear(); driver.findElement(By.name("username")).sendKeys("john"); driver.findElement(By.name("password")).clear(); driver.findElement(By.name("password")).sendKeys("demo"); driver.findElement(By.cssSelector("input.button")).click(); String totalAmmount = driver.findElement(By.xpath("//table[@id='accountTable']/tbody/tr[12]/td[2]/b")).getText(); System.out.println(totalAmmount);After copying the Rows in the IDE.
IT Professional Academy
51
Copyright 2015 IT Professional Academy52Convert to Junit Web Driver CodeConvert to JUnitWeb Driver Code
IT Professional Academy
52
Copyright 2015 IT Professional Academy53Selenium DAY 1 Ends.Thank you.
IT Professional Academy
53