SlideShare a Scribd company logo
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
What Will You Learn Today?
 Limitations of Selenium WebDriver
 No support for testing images
 Not efficient Managing test cases
 No support Report generation
 Sikuli for testing images on the web
 Annotating tests and managing test cases using TestNG
 Generating HTML reports using TestNG
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Sikuli & TestNG Are Used In Selenium
WebDriver Because Of Its Limitations
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Shortcomings Of Selenium WebDriver
Dependency on external tools for Test management
Images cannot be tested in Web applications
Does not have Reporting facility
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
I have to verify
the images that
are present in
the web page
But, Selenium
doesn’t support
image based
testing
NOTE: Sikuli and Selenium can be integrated to also automate desktop applications
Need To Do Image Based Testing
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
I have to verify
the images that
are present in
the web page
But, Selenium
doesn’t support
image based
testing
NOTE: Sikuli and Selenium can be integrated to also automate desktop applications
Simple. Integrate
Sikuli with
Selenium for
testing images
Sikuli For Image Testing
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Selenium + Sikuli
Selenium
Sikuli
Image Testing + Web Testing
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
How Does Sikuli Work?
• Uses image recognition techniques to test images visible on screen
• It then performs operations on those images
• Provides a GUI for scripting where screenshots/ images are sent as
parameters
“Automate anything you see on your screen ”
-
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Sikuli IDE
• find
• findAll
• wait
• waitVanish
• exists
Image Searching Commands
• click
• doubleClick
• hover
• dragDrop
• rightClick
Mouse Action Commands
Image to be
recognized
Action to be
performed
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
I have a very long
code. Managing
various Test cases
is wearisome!
Neither do I
get detailed
reports about
those tests!!
Other Limitations Of Selenium
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
I have a very long
code. Managing
various Test cases
is wearisome!
Neither do I
get detailed
reports about
those tests!!
Both the problems can
be solved!
Use TestNG in Selenium
for Test management &
Report generation
TestNG To The Rescue
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
What Is TestNG?
TestNG is an open source testing framework inspired by JUnit. It stands for Test Next Generation
TestNG is more flexible & powerful than JUnit because of below functionalities:
T e s t
S c r i p t s
T E S T R E P O R T S
Prioritization
Method
Dependency
Parallel
Testing
Assertions
Disabling
Test Cases
GroupingAnnotations
Report
Generation
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Advantages Of Using TestNG
• HTML reports can be generated
• Supports parallel testing
• Test cases can be grouped & prioritized easily
• Uses annotations for executing methods
• Supports parameterization
Note: Java is a pre-requisite for TestNG
1. Write the business logic of the test and insert TestNG annotations in the code
2. Add the information about your test (e.g. the class names, methods names,
groups names etc.) in a testng.xml file or build.xml file
3. Run TestNG
Steps for writing TestNG tests
Advantages of using TestNG
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Annotations In TestNG
Annotations in TestNG are used to control the next method to be executed in the program
TestNG programs will not have ‘main’ method. However, all methods will be annotated with ‘@’
Test methods – Primary methods to be executed
Will be executed before both test method
Will be executed after both test method
A n n o t a t i o n s P r i o r i t i z a t i o n
R e p o r t
G e n e ra t i o n
P a r a l l e l
Te s t i n g
A s s e r t i o n sG r o u p i n g
M e t h o d
D e p e n d e n c y
D i s a b l i n g
Te s t C a s e s
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
List Of Annotations In TestNG
TESTNG ANNOTAIONS DESCRIPTION
@BeforeSuite Annotated method will run before all the tests in the suite have run
@AfterSuite Annotated method will run after all the tests in the suite have run
@BeforeTest Annotated method will run before any test method belonging to the classes is run
@AfterTest Annotated method will run after all the test methods belonging to the classes have run
@BeforeGroup Annotated method will run before each group is run
@AfterGroup Annotated method will run after every group is run
@BeforeClass Annotated method will run once before the first test method in the current class is invoked
@AfterClass Annotated method will run once after all the test methods in the current class have run
@BeforeMethod Annotated method will run before any test method belonging to the classes is run
@AfterMethod Annotated method will run after all the test methods belonging to the classes have run
@Test Annotated method is a part of test
A n n o t a t i o n s P r i o r i t i z a t i o n
R e p o r t
G e n e ra t i o n
P a r a l l e l
Te s t i n g
A s s e r t i o n sG r o u p i n g
M e t h o d
D e p e n d e n c y
D i s a b l i n g
Te s t C a s e s
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Examples Of Annotations In TestNG
public class TestngAnnotation {
@Test
public void testCase1()
{
System.out.println("in test case 1");
}
@BeforeMethod
public void beforeMethod() {
System.out.println("in beforeMethod");
}
@AfterMethod
public void afterMethod()
{
System.out.println("in afterMethod");
}
@BeforeTest
public void beforeTest()
{
System.out.println("in beforeTest");
}
@AfterTest
public void afterTest()
{
System.out.println("in afterTest");
} }
Main method to be executed
Will be executed before every test method
Will be executed after every test method
Will be executed before test
Will be executed after test
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Prioritization In TestNG
Annotated methods can be prioritized in TestNG
Priority can be assigned as parameters while calling the test cases
If no priority is defined, then the test cases will be executed in alphabetical order
Note: In this case, secondTest() will run first and then firstTest() will run
A n n o t a t i o n s P r i o r i t i z a t i o n
R e p o r t
G e n e ra t i o n
P a r a l l e l
Te s t i n g
A s s e r t i o n sG r o u p i n g
M e t h o d
D e p e n d e n c y
D i s a b l i n g
Te s t C a s e s
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Method Dependency In TestNG
Will execute only if finalTest() method passes
A n n o t a t i o n s P r i o r i t i z a t i o n
R e p o r t
G e n e ra t i o n
P a r a l l e l
Te s t i n g
A s s e r t i o n sG r o u p i n g
M e t h o d
D e p e n d e n c y
D i s a b l i n g
Te s t C a s e s
In TestNG, we can use dependsOnMethods to implement dependency testing
If the dependent method fails, then all the subsequent methods will be skipped
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Always Running Tests In TestNG
In TestNG, we can also choose to run a particular test irrespective of the fail/ pass condition of depending method
We can control that by setting the alwaysRun attribute in @Test annotation; alwaysRun = true
This test will run irrespective of finalTest()
passing/ failing
A n n o t a t i o n s P r i o r i t i z a t i o n
R e p o r t
G e n e ra t i o n
P a r a l l e l
Te s t i n g
A s s e r t i o n sG r o u p i n g
D i s a b l i n g
Te s t C a s e s
M e t h o d
D e p e n d e n c y
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Disabling Test Cases
In TestNG, we can enable or disable test/ test cases as per needs
We can control that by setting the enable attribute in @Test annotation; enabled=true or enabled=false
This test will never be executed in the test case
A n n o t a t i o n s P r i o r i t i z a t i o n
R e p o r t
G e n e ra t i o n
P a r a l l e l
Te s t i n g
A s s e r t i o n sG r o u p i n g
M e t h o d
D e p e n d e n c y
D i s a b l i n g
Te s t C a s e s
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Grouping Tests Into Test Cases
In TestNG, we can categorize certain methods into groups
Methods with same group name can be executed in one group
We can control that by setting the group attribute in @Test annotation; groups={“xxx”}
Note: A Test Case can belong to multiple test groups
A n n o t a t i o n s P r i o r i t i z a t i o n
R e p o r t
G e n e ra t i o n
P a r a l l e l
Te s t i n g
A s s e r t i o n sG r o u p i n g
M e t h o d
D e p e n d e n c y
D i s a b l i n g
Te s t C a s e s
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Assertions In TestNG
Assertions can be used in TestNG to compare the actual result with the expected result
Check if both String 1 and String 2 are equal
Check if call to aMethodCall() returns true
Checks if driver.getTitle() returns vale as “Gmail”
A n n o t a t i o n s P r i o r i t i z a t i o n
R e p o r t
G e n e ra t i o n
P a r a l l e l
Te s t i n g
A s s e r t i o n sG r o u p i n g
M e t h o d
D e p e n d e n c y
D i s a b l i n g
Te s t C a s e s
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Parallel Testing Using TestNG
TestNG provides support for executing scripts in parallel, saving lot of time
Multiple browser testing can be achieved as same scripts can be executed in multiple browser at the same time
A n n o t a t i o n s P r i o r i t i z a t i o n
R e p o r t
G e n e ra t i o n
P a r a l l e l
Te s t i n g
A s s e r t i o n sG r o u p i n g
M e t h o d
D e p e n d e n c y
D i s a b l i n g
Te s t C a s e s
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Running A TestNG Group Of Tests Via testng.xml
We can execute methods belonging to a group in TestNG, by creating testng.xml files
Grouping is one of the annotations, used to execute multiple tests
Open Eclipse and create a new file with the name testng.xml. Add the following code to the said file
This xml file contains only one test inside a suite. This
contains the groups section defined by using the groups
tag as shown in the code. The run tag represents the
group that needs to be run. The include tag represents
the name of the group that needs to be executed.
A n n o t a t i o n s P r i o r i t i z a t i o n
R e p o r t
G e n e ra t i o n
P a r a l l e l
Te s t i n g
A s s e r t i o n sG r o u p i n g
M e t h o d
D e p e n d e n c y
D i s a b l i n g
Te s t C a s e s
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
HTML Reports In TestNG
We can obtain detailed HTML test reports using TestNG
All test reports are saved in the test-output folder in eclipse project directory
A n n o t a t i o n s P r i o r i t i z a t i o n
R e p o r t
G e n e ra t i o n
P a r a l l e l
Te s t i n g
A s s e r t i o n sG r o u p i n g
M e t h o d
D e p e n d e n c y
D i s a b l i n g
Te s t C a s e s
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING
Course Details & Customer Reviews
Go to www.edureka.co/testing-with-selenium-webdriver
Get Edureka Certified in Selenium Today!
Radha Muthian says, “I learned Selenium WebDriver and the course
was very helpful to automate the Web Applications. The lifetime
access of classes helps a lot to refer back and download the codes.”
Vijay Krishnan says, “I have attended Selenium Web driver Certification with
Edureka. The trainer has explained all the concepts of the course in detail
manner which was very easy to understand. Worth for the money spent!!!!”
Tom Tully says, “I wanted to learn Selenium Webdriver in a live, real
course, not self paced, so there would be pressure on me to finish.
Edureka accomplished this at a price far lower than an in-person class,
and as far as I know they are the only internet class that has live lectures
on this subject. Teacher was very knowledgeable. I learned basic use of
Selenium. No problem with me being in US and teacher in India. They
have US 800 number.”
Suhas Kashyap says, “The online Course(Selenium Webdriver), which
I took from Edureka was interactive and also helped me to improve
my knowledge on selenium. Further helped me in changing the job as
well. Thanks Edureka Team... :).”
www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING

More Related Content

PPTX
TestNG Session presented in Xebia XKE
PDF
Web automation using selenium.ppt
PPT
QSpiders - Automation using Selenium
PPTX
TestNG Framework
PPT
Selenium Automation Framework
PPTX
Test Automation and Selenium
PDF
TestNG introduction
TestNG Session presented in Xebia XKE
Web automation using selenium.ppt
QSpiders - Automation using Selenium
TestNG Framework
Selenium Automation Framework
Test Automation and Selenium
TestNG introduction

What's hot (20)

PPTX
Automation Testing by Selenium Web Driver
PPTX
PDF
TestNG - The Next Generation of Unit Testing
PDF
TestNG Annotations in Selenium | Edureka
KEY
Selenium Grid
PPTX
Test NG Framework Complete Walk Through
PPT
Selenium Concepts
PDF
SELENIUM PPT.pdf
PPTX
Introduction to Selenium Web Driver
PDF
Cypress - Best Practices
PPTX
Selenium WebDriver
PPTX
Automation - web testing with selenium
PPT
Selenium ppt
PPTX
Introduction to selenium
PPTX
TestNG Session presented in PB
PPTX
TestNG with selenium
PPTX
Selenium introduction
PPTX
Cypress test techniques cucumber bdd framework,tdd,api tests course
PPTX
Selenium ppt
PPT
Automated Web Testing Using Selenium
Automation Testing by Selenium Web Driver
TestNG - The Next Generation of Unit Testing
TestNG Annotations in Selenium | Edureka
Selenium Grid
Test NG Framework Complete Walk Through
Selenium Concepts
SELENIUM PPT.pdf
Introduction to Selenium Web Driver
Cypress - Best Practices
Selenium WebDriver
Automation - web testing with selenium
Selenium ppt
Introduction to selenium
TestNG Session presented in PB
TestNG with selenium
Selenium introduction
Cypress test techniques cucumber bdd framework,tdd,api tests course
Selenium ppt
Automated Web Testing Using Selenium
Ad

Similar to Selenium Training | TestNG Framework For Selenium | Selenium Tutorial For Beginners | Edureka (20)

PPTX
Dev labs alliance top 20 testng interview questions for sdet
PDF
Test ng for testers
PPTX
Applicabilitity of Machine Learning in Test Automation @ Delex Conf 2018, Minsk
PDF
Software Testing Tutorial For Beginners | Manual & Automation Testing | Selen...
DOCX
Testing concept definition
PDF
Manage Testing by Dependencies—Not Activities
PPSX
The Components Of Testing 0309 V2
PDF
Selenium Training and Certification.pdf
PDF
Myths about Exploratory Testing - Agile Testing Days
PDF
Webtests Reloaded - Webtest with Selenium, TestNG, Groovy and Maven
PPT
Application Testing
PDF
SoapUI: Day5: web service test steps in soapui
PPTX
Selenium IDE Tutorial For Beginners | What Is Selenium IDE? | Selenium Tutori...
PDF
2007 Microsoft Excel Test Score
PDF
Test Cases in Software Testing Examples PDF By QA Company in USA
PDF
Testing in java
PDF
19 creamer et workshop-agile2019-wash_pp_16-9_1
PPTX
Quality Leadership, Testing, and Governance Tactics that Make or Break Your P...
PDF
Maintaining test fairness
PPT
Selenium and Cucumber Selenium Conf 2011
Dev labs alliance top 20 testng interview questions for sdet
Test ng for testers
Applicabilitity of Machine Learning in Test Automation @ Delex Conf 2018, Minsk
Software Testing Tutorial For Beginners | Manual & Automation Testing | Selen...
Testing concept definition
Manage Testing by Dependencies—Not Activities
The Components Of Testing 0309 V2
Selenium Training and Certification.pdf
Myths about Exploratory Testing - Agile Testing Days
Webtests Reloaded - Webtest with Selenium, TestNG, Groovy and Maven
Application Testing
SoapUI: Day5: web service test steps in soapui
Selenium IDE Tutorial For Beginners | What Is Selenium IDE? | Selenium Tutori...
2007 Microsoft Excel Test Score
Test Cases in Software Testing Examples PDF By QA Company in USA
Testing in java
19 creamer et workshop-agile2019-wash_pp_16-9_1
Quality Leadership, Testing, and Governance Tactics that Make or Break Your P...
Maintaining test fairness
Selenium and Cucumber Selenium Conf 2011
Ad

More from Edureka! (20)

PDF
What to learn during the 21 days Lockdown | Edureka
PDF
Top 10 Dying Programming Languages in 2020 | Edureka
PDF
Top 5 Trending Business Intelligence Tools | Edureka
PDF
Tableau Tutorial for Data Science | Edureka
PDF
Python Programming Tutorial | Edureka
PDF
Top 5 PMP Certifications | Edureka
PDF
Top Maven Interview Questions in 2020 | Edureka
PDF
Linux Mint Tutorial | Edureka
PDF
How to Deploy Java Web App in AWS| Edureka
PDF
Importance of Digital Marketing | Edureka
PDF
RPA in 2020 | Edureka
PDF
Email Notifications in Jenkins | Edureka
PDF
EA Algorithm in Machine Learning | Edureka
PDF
Cognitive AI Tutorial | Edureka
PDF
AWS Cloud Practitioner Tutorial | Edureka
PDF
Blue Prism Top Interview Questions | Edureka
PDF
Big Data on AWS Tutorial | Edureka
PDF
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
PDF
Kubernetes Installation on Ubuntu | Edureka
PDF
Introduction to DevOps | Edureka
What to learn during the 21 days Lockdown | Edureka
Top 10 Dying Programming Languages in 2020 | Edureka
Top 5 Trending Business Intelligence Tools | Edureka
Tableau Tutorial for Data Science | Edureka
Python Programming Tutorial | Edureka
Top 5 PMP Certifications | Edureka
Top Maven Interview Questions in 2020 | Edureka
Linux Mint Tutorial | Edureka
How to Deploy Java Web App in AWS| Edureka
Importance of Digital Marketing | Edureka
RPA in 2020 | Edureka
Email Notifications in Jenkins | Edureka
EA Algorithm in Machine Learning | Edureka
Cognitive AI Tutorial | Edureka
AWS Cloud Practitioner Tutorial | Edureka
Blue Prism Top Interview Questions | Edureka
Big Data on AWS Tutorial | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
Kubernetes Installation on Ubuntu | Edureka
Introduction to DevOps | Edureka

Recently uploaded (20)

PDF
top salesforce developer skills in 2025.pdf
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPTX
Computer Software and OS of computer science of grade 11.pptx
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PPTX
history of c programming in notes for students .pptx
PPTX
assetexplorer- product-overview - presentation
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Digital Strategies for Manufacturing Companies
PDF
System and Network Administraation Chapter 3
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Understanding Forklifts - TECH EHS Solution
PPTX
Reimagine Home Health with the Power of Agentic AI​
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
top salesforce developer skills in 2025.pdf
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Computer Software and OS of computer science of grade 11.pptx
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Internet Downloader Manager (IDM) Crack 6.42 Build 41
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
history of c programming in notes for students .pptx
assetexplorer- product-overview - presentation
How to Migrate SBCGlobal Email to Yahoo Easily
Upgrade and Innovation Strategies for SAP ERP Customers
Digital Strategies for Manufacturing Companies
System and Network Administraation Chapter 3
Softaken Excel to vCard Converter Software.pdf
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
VVF-Customer-Presentation2025-Ver1.9.pptx
Design an Analysis of Algorithms I-SECS-1021-03
Understanding Forklifts - TECH EHS Solution
Reimagine Home Health with the Power of Agentic AI​
Design an Analysis of Algorithms II-SECS-1021-03
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf

Selenium Training | TestNG Framework For Selenium | Selenium Tutorial For Beginners | Edureka

  • 2. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING What Will You Learn Today?  Limitations of Selenium WebDriver  No support for testing images  Not efficient Managing test cases  No support Report generation  Sikuli for testing images on the web  Annotating tests and managing test cases using TestNG  Generating HTML reports using TestNG
  • 3. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Sikuli & TestNG Are Used In Selenium WebDriver Because Of Its Limitations
  • 4. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Shortcomings Of Selenium WebDriver Dependency on external tools for Test management Images cannot be tested in Web applications Does not have Reporting facility
  • 5. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING I have to verify the images that are present in the web page But, Selenium doesn’t support image based testing NOTE: Sikuli and Selenium can be integrated to also automate desktop applications Need To Do Image Based Testing
  • 6. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING I have to verify the images that are present in the web page But, Selenium doesn’t support image based testing NOTE: Sikuli and Selenium can be integrated to also automate desktop applications Simple. Integrate Sikuli with Selenium for testing images Sikuli For Image Testing
  • 7. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Selenium + Sikuli Selenium Sikuli Image Testing + Web Testing
  • 8. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING How Does Sikuli Work? • Uses image recognition techniques to test images visible on screen • It then performs operations on those images • Provides a GUI for scripting where screenshots/ images are sent as parameters “Automate anything you see on your screen ” -
  • 9. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Sikuli IDE • find • findAll • wait • waitVanish • exists Image Searching Commands • click • doubleClick • hover • dragDrop • rightClick Mouse Action Commands Image to be recognized Action to be performed
  • 10. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING I have a very long code. Managing various Test cases is wearisome! Neither do I get detailed reports about those tests!! Other Limitations Of Selenium
  • 11. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING I have a very long code. Managing various Test cases is wearisome! Neither do I get detailed reports about those tests!! Both the problems can be solved! Use TestNG in Selenium for Test management & Report generation TestNG To The Rescue
  • 12. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING What Is TestNG? TestNG is an open source testing framework inspired by JUnit. It stands for Test Next Generation TestNG is more flexible & powerful than JUnit because of below functionalities: T e s t S c r i p t s T E S T R E P O R T S Prioritization Method Dependency Parallel Testing Assertions Disabling Test Cases GroupingAnnotations Report Generation
  • 13. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Advantages Of Using TestNG • HTML reports can be generated • Supports parallel testing • Test cases can be grouped & prioritized easily • Uses annotations for executing methods • Supports parameterization Note: Java is a pre-requisite for TestNG 1. Write the business logic of the test and insert TestNG annotations in the code 2. Add the information about your test (e.g. the class names, methods names, groups names etc.) in a testng.xml file or build.xml file 3. Run TestNG Steps for writing TestNG tests Advantages of using TestNG
  • 14. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Annotations In TestNG Annotations in TestNG are used to control the next method to be executed in the program TestNG programs will not have ‘main’ method. However, all methods will be annotated with ‘@’ Test methods – Primary methods to be executed Will be executed before both test method Will be executed after both test method A n n o t a t i o n s P r i o r i t i z a t i o n R e p o r t G e n e ra t i o n P a r a l l e l Te s t i n g A s s e r t i o n sG r o u p i n g M e t h o d D e p e n d e n c y D i s a b l i n g Te s t C a s e s
  • 15. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING List Of Annotations In TestNG TESTNG ANNOTAIONS DESCRIPTION @BeforeSuite Annotated method will run before all the tests in the suite have run @AfterSuite Annotated method will run after all the tests in the suite have run @BeforeTest Annotated method will run before any test method belonging to the classes is run @AfterTest Annotated method will run after all the test methods belonging to the classes have run @BeforeGroup Annotated method will run before each group is run @AfterGroup Annotated method will run after every group is run @BeforeClass Annotated method will run once before the first test method in the current class is invoked @AfterClass Annotated method will run once after all the test methods in the current class have run @BeforeMethod Annotated method will run before any test method belonging to the classes is run @AfterMethod Annotated method will run after all the test methods belonging to the classes have run @Test Annotated method is a part of test A n n o t a t i o n s P r i o r i t i z a t i o n R e p o r t G e n e ra t i o n P a r a l l e l Te s t i n g A s s e r t i o n sG r o u p i n g M e t h o d D e p e n d e n c y D i s a b l i n g Te s t C a s e s
  • 16. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Examples Of Annotations In TestNG public class TestngAnnotation { @Test public void testCase1() { System.out.println("in test case 1"); } @BeforeMethod public void beforeMethod() { System.out.println("in beforeMethod"); } @AfterMethod public void afterMethod() { System.out.println("in afterMethod"); } @BeforeTest public void beforeTest() { System.out.println("in beforeTest"); } @AfterTest public void afterTest() { System.out.println("in afterTest"); } } Main method to be executed Will be executed before every test method Will be executed after every test method Will be executed before test Will be executed after test
  • 17. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Prioritization In TestNG Annotated methods can be prioritized in TestNG Priority can be assigned as parameters while calling the test cases If no priority is defined, then the test cases will be executed in alphabetical order Note: In this case, secondTest() will run first and then firstTest() will run A n n o t a t i o n s P r i o r i t i z a t i o n R e p o r t G e n e ra t i o n P a r a l l e l Te s t i n g A s s e r t i o n sG r o u p i n g M e t h o d D e p e n d e n c y D i s a b l i n g Te s t C a s e s
  • 18. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Method Dependency In TestNG Will execute only if finalTest() method passes A n n o t a t i o n s P r i o r i t i z a t i o n R e p o r t G e n e ra t i o n P a r a l l e l Te s t i n g A s s e r t i o n sG r o u p i n g M e t h o d D e p e n d e n c y D i s a b l i n g Te s t C a s e s In TestNG, we can use dependsOnMethods to implement dependency testing If the dependent method fails, then all the subsequent methods will be skipped
  • 19. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Always Running Tests In TestNG In TestNG, we can also choose to run a particular test irrespective of the fail/ pass condition of depending method We can control that by setting the alwaysRun attribute in @Test annotation; alwaysRun = true This test will run irrespective of finalTest() passing/ failing A n n o t a t i o n s P r i o r i t i z a t i o n R e p o r t G e n e ra t i o n P a r a l l e l Te s t i n g A s s e r t i o n sG r o u p i n g D i s a b l i n g Te s t C a s e s M e t h o d D e p e n d e n c y
  • 20. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Disabling Test Cases In TestNG, we can enable or disable test/ test cases as per needs We can control that by setting the enable attribute in @Test annotation; enabled=true or enabled=false This test will never be executed in the test case A n n o t a t i o n s P r i o r i t i z a t i o n R e p o r t G e n e ra t i o n P a r a l l e l Te s t i n g A s s e r t i o n sG r o u p i n g M e t h o d D e p e n d e n c y D i s a b l i n g Te s t C a s e s
  • 21. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Grouping Tests Into Test Cases In TestNG, we can categorize certain methods into groups Methods with same group name can be executed in one group We can control that by setting the group attribute in @Test annotation; groups={“xxx”} Note: A Test Case can belong to multiple test groups A n n o t a t i o n s P r i o r i t i z a t i o n R e p o r t G e n e ra t i o n P a r a l l e l Te s t i n g A s s e r t i o n sG r o u p i n g M e t h o d D e p e n d e n c y D i s a b l i n g Te s t C a s e s
  • 22. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Assertions In TestNG Assertions can be used in TestNG to compare the actual result with the expected result Check if both String 1 and String 2 are equal Check if call to aMethodCall() returns true Checks if driver.getTitle() returns vale as “Gmail” A n n o t a t i o n s P r i o r i t i z a t i o n R e p o r t G e n e ra t i o n P a r a l l e l Te s t i n g A s s e r t i o n sG r o u p i n g M e t h o d D e p e n d e n c y D i s a b l i n g Te s t C a s e s
  • 23. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Parallel Testing Using TestNG TestNG provides support for executing scripts in parallel, saving lot of time Multiple browser testing can be achieved as same scripts can be executed in multiple browser at the same time A n n o t a t i o n s P r i o r i t i z a t i o n R e p o r t G e n e ra t i o n P a r a l l e l Te s t i n g A s s e r t i o n sG r o u p i n g M e t h o d D e p e n d e n c y D i s a b l i n g Te s t C a s e s
  • 24. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Running A TestNG Group Of Tests Via testng.xml We can execute methods belonging to a group in TestNG, by creating testng.xml files Grouping is one of the annotations, used to execute multiple tests Open Eclipse and create a new file with the name testng.xml. Add the following code to the said file This xml file contains only one test inside a suite. This contains the groups section defined by using the groups tag as shown in the code. The run tag represents the group that needs to be run. The include tag represents the name of the group that needs to be executed. A n n o t a t i o n s P r i o r i t i z a t i o n R e p o r t G e n e ra t i o n P a r a l l e l Te s t i n g A s s e r t i o n sG r o u p i n g M e t h o d D e p e n d e n c y D i s a b l i n g Te s t C a s e s
  • 25. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING HTML Reports In TestNG We can obtain detailed HTML test reports using TestNG All test reports are saved in the test-output folder in eclipse project directory A n n o t a t i o n s P r i o r i t i z a t i o n R e p o r t G e n e ra t i o n P a r a l l e l Te s t i n g A s s e r t i o n sG r o u p i n g M e t h o d D e p e n d e n c y D i s a b l i n g Te s t C a s e s
  • 26. www.edureka.co/testing-with-selenium-webdriverEDUREKA’S SELENIUM CERTIFICATION TRAINING Course Details & Customer Reviews Go to www.edureka.co/testing-with-selenium-webdriver Get Edureka Certified in Selenium Today! Radha Muthian says, “I learned Selenium WebDriver and the course was very helpful to automate the Web Applications. The lifetime access of classes helps a lot to refer back and download the codes.” Vijay Krishnan says, “I have attended Selenium Web driver Certification with Edureka. The trainer has explained all the concepts of the course in detail manner which was very easy to understand. Worth for the money spent!!!!” Tom Tully says, “I wanted to learn Selenium Webdriver in a live, real course, not self paced, so there would be pressure on me to finish. Edureka accomplished this at a price far lower than an in-person class, and as far as I know they are the only internet class that has live lectures on this subject. Teacher was very knowledgeable. I learned basic use of Selenium. No problem with me being in US and teacher in India. They have US 800 number.” Suhas Kashyap says, “The online Course(Selenium Webdriver), which I took from Edureka was interactive and also helped me to improve my knowledge on selenium. Further helped me in changing the job as well. Thanks Edureka Team... :).”

Editor's Notes

  • #13: InvocationCount Attributes
  • #27: Add photos