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
Selenium with java
PPTX
PDF
What is Jenkins | Jenkins Tutorial for Beginners | Edureka
PPTX
Jenkins for java world
PPT
PPT
Automated Testing vs Manual Testing
PPT
Automation testing
Selenium with java
What is Jenkins | Jenkins Tutorial for Beginners | Edureka
Jenkins for java world
Automated Testing vs Manual Testing
Automation testing

What's hot (20)

PPTX
Maven ppt
PDF
Jenkins Pipelines
PPTX
TestNG Session presented in PB
PPTX
Behavior driven development (bdd)
PPTX
Test automation
PDF
Automation Testing using Selenium
PPTX
Unit testing JavaScript: Jasmine & karma intro
PPTX
BDD WITH CUCUMBER AND JAVA
PPTX
Maven
PDF
Behavior-Driven Development and Automation Testing Using Cucumber Framework W...
PPTX
Automation Testing With Appium
PPTX
Introduction to Selenium Web Driver
PPT
Automation testing strategy, approach & planning
PPTX
Hybrid automation framework
PPTX
Agile Testing by Example
PPTX
Automation Testing
PPTX
Selenium WebDriver training
PDF
Test Driven Development (TDD)
PPT
Qtp Basics
PPTX
Test Driven Development (TDD) Preso 360|Flex 2010
Maven ppt
Jenkins Pipelines
TestNG Session presented in PB
Behavior driven development (bdd)
Test automation
Automation Testing using Selenium
Unit testing JavaScript: Jasmine & karma intro
BDD WITH CUCUMBER AND JAVA
Maven
Behavior-Driven Development and Automation Testing Using Cucumber Framework W...
Automation Testing With Appium
Introduction to Selenium Web Driver
Automation testing strategy, approach & planning
Hybrid automation framework
Agile Testing by Example
Automation Testing
Selenium WebDriver training
Test Driven Development (TDD)
Qtp Basics
Test Driven Development (TDD) Preso 360|Flex 2010
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
TestNG Annotations in Selenium | Edureka
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...
PPTX
Test NG Framework Complete Walk Through
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...
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
TestNG Annotations in Selenium | Edureka
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...
Test NG Framework Complete Walk Through
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...
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
DuckDuckGo Private Browser Premium APK for Android Crack Latest 2025
PDF
Website Design Services for Small Businesses.pdf
PDF
Autodesk AutoCAD Crack Free Download 2025
PPTX
Download Adobe Photoshop Crack 2025 Free
PPTX
MLforCyber_MLDataSetsandFeatures_Presentation.pptx
PPTX
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
PPTX
Advanced SystemCare Ultimate Crack + Portable (2025)
PDF
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
PPTX
"Secure File Sharing Solutions on AWS".pptx
PPTX
Full-Stack Developer Courses That Actually Land You Jobs
PDF
Introduction to Ragic - #1 No Code Tool For Digitalizing Your Business Proces...
PPTX
GSA Content Generator Crack (2025 Latest)
PPTX
Trending Python Topics for Data Visualization in 2025
PDF
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
PDF
BoxLang Dynamic AWS Lambda - Japan Edition
PDF
Visual explanation of Dijkstra's Algorithm using Python
PDF
iTop VPN Crack Latest Version Full Key 2025
PDF
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
PPTX
Airline CRS | Airline CRS Systems | CRS System
PPTX
CNN LeNet5 Architecture: Neural Networks
DuckDuckGo Private Browser Premium APK for Android Crack Latest 2025
Website Design Services for Small Businesses.pdf
Autodesk AutoCAD Crack Free Download 2025
Download Adobe Photoshop Crack 2025 Free
MLforCyber_MLDataSetsandFeatures_Presentation.pptx
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
Advanced SystemCare Ultimate Crack + Portable (2025)
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
"Secure File Sharing Solutions on AWS".pptx
Full-Stack Developer Courses That Actually Land You Jobs
Introduction to Ragic - #1 No Code Tool For Digitalizing Your Business Proces...
GSA Content Generator Crack (2025 Latest)
Trending Python Topics for Data Visualization in 2025
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
BoxLang Dynamic AWS Lambda - Japan Edition
Visual explanation of Dijkstra's Algorithm using Python
iTop VPN Crack Latest Version Full Key 2025
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
Airline CRS | Airline CRS Systems | CRS System
CNN LeNet5 Architecture: Neural Networks

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