Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

**Advance Selenium Framework:**

What is Framework:
1. Basically framework is nothing but systematic and sequential
way to write/automate the scripts for the application
2.framework is a set of rules
3.framework is a structural way for building/automating
application
4. What is Selenium Framework?
Selenium framework’s code structure helps you to reuse the
code, reduce code maintenance, higher code readability, and
allows multiple users to work on the same piece of the
program.
5. Why do we need the Selenium Framework?
• Easy code maintenance
• Increase in code re-usage
• Higher code readability
• Reduced script maintenance cost
• Reduced tests’ time execution
• Reduced human resources
Easy reporting

[Type here]
6. **Components of the Framework**
Programming language: Java + Selenium
IDE: Eclipse
Testing Framework: TestNG
Version Control: GIT
Continuous Integration: JENKINS
7. **Types of Selenium Automation Frameworks**
1. Data-driven Framework
2. Keyword Driven Testing Framework
3. Hybrid Driven Testing Framework
Data-driven Framework: So as name suggest data driven tell us
about test data in the table and tabular format, data driven
stores test data in table or in a spreadsheet, multiple inputs
that stores in excel
So I am working on hybrid driven framework which is
Combination of data+ keyword driven framework.
8) In the hybrid driven framework I am involved in the data
driven framework
9) data driven allows the automate the application using test
script which can execute test for all the test data in the table
10) in this input values are read from data files and are fetched
&stored into a variable in the test scripts

[Type here]
11) so in data driven we are covering both positive and
negative test cases into the single test
12) For scripting we are using maven project , maven is
software project management tool it is a build automation tool.
13) which is used to build the project, generating
documentation and managing reports from central piece of
information
14)Features of Maven:

a)we can add dependencies in to the maven project


,dependencies are nothing but it is third party tools which we
are using in our project
[Type here]
b) if we want to build our java project in to the executable jar
or war files then we can use maven project
c) Able to work with multiple project at the same time
15) so maven is one of the automation tool which is supported
with eclipse
16 ) for maven project we can use multiple languages like
java, c#,python, ruby etc.. in our project we have used java
language.
17) maven is based on POM: project object model, it helps us
to build projects, dependencies and documentation
Framework by using Page Object Model design pattern with
Page Factory. Whenever we create a maven project it consists
of different folders like src/main/java, src/test/java, maven
dependencies, jre system libraries, pom.xml also we can create
different folders as per our need
POM uses encapsulation feature of OOPs, where variables are
private and methods are public and we use getter and setter
methods but there is disadvantage of POM that is it can not
find the hidden elements so we use page factory class to
overcome disadvantage of POM
In page factory we use @findby annotation above your web
element and we have to use static method like initelement to
initialize the data member in page factory.

[Type here]
17) maven increases the performance of project and building
process
18) plugins are used to create jar files and to create project
documentation
19)in src/main/ java we use POM classes
POM: As per the Page Object Model, we have maintained a
class for every web page. Each web page has a separate class,
and that class holds the functionality and members of that web
page. Separate classes for every individual test.
21) Packages: We have separate packages for Pages and Tests.
All the web page related classes come under the Pages package
and all the tests related classes come under Test’s package.
22) For example, Home Page and Login Page have separate
classes to store element locators. For the login test, there
would be a separate class which calls the methods from the
Home Page class and Login Page class.
23) As per the above maven project, all the tests are kept in the
‘src/test/java‘ and remaining files (such as config.properties,
element locators (POM classes), utility files, test data, etc.,)
kept under ‘src/main/java‘.
24) pom.xml:
It is one of the important xml file which is created under
maven project , we can call it as heart of maven project

[Type here]
it has different tabs like overview, dependencies, dependencies
hierarchy, effective pom, pom.xml
25)in overview there are artifact details and project details like
group id, artifact id, version, project name, url is there and in
dependencies there are dependencies which we have added
in our project ..we can add it and remove it as per our
requirement then there comes the dependencies hierarchy
where as its name says hierarchy of dependencies are there.
26)then in effective pom it is detailed xml file ,all information
about project you will find here
27)at last pom.xml tab: it has group id, artifact id, version
details are there.
28)in pom.xml we add the different dependencies which we
needed in our project , suppose we want to add dependencies
for selenium webdriver, testng, apache poi, AUTOIT
29)to add the dependencies first we have to go on to the
maven repository website and then search for selenium
webdriver, here you will find the jar files of it
(dependencies are nothing but the jar files and it is a third party
tools which we are using in our project)
30)now select mostly used jar files and copy xml code of that
and past it in pom.xml under dependencies tag , likewise we
can add other dependencies too.

[Type here]
TestNG:
31)For proper reports and documentation we are using TestNG
32)TestNG is unit testing framework, inspired from junit &
nunit by adding new functionalities which made TestNG more
powerful than other framework
33)Why we use testNG ,There are certain benefits using
TestNG: a)Generate detailed HTML test reports
b)run test cases in groups
c)Parallel test execution
d)Control test execution
e)Annotations made tester life easy
34)Selenium test do not generate proper format reports for
test results , using testNG we can generate detailed result
report that include:
35)Number of test cases run, how many test cases passed, how
many test cases failed, how many test cases skipped, time
requires run test cases
36) we can create group of multiple test cases so we can
priorities the test cases , which test cases to be executed first
37)some test cases can be executed for multiple times without
loops just by using keyword called as invocationcount
[Type here]
38)Annotations are easy to understand
39) testNG do not need main method and static keyword &
exceptions are automatically handled by testNG
There are following annotations used in testing:
1)@beforesuit: to initiate the data base connection
2)@beforeclass: to create the connection to open application
3)@beforemethod: to login into the application
4)@test: to perform the multiple test(we write test scenarios
here), (to validate and verify)
5)@aftermethod: to logout into the application
6)@afterclass: to close the application
7)aftersuit: to close data base connection
40) sequence of execution of test annotaions will be same as
above it is written
41)beforemethod, test,aftermethod will continously run every
time
42)testNG generates test output folder in that it will have
emailable.html
43)whenever any test cases fails it generates testng_failed.xml
file, we can run this xml file separately
44)There are following Keywords used in TestNG

[Type here]
a) invocationcount: Sometimes single test case need to be
executed for multiple times at that invocationcount is used
syntax: @test(invocationCount=3)
b)priority: we decide execution flow of our test cases, so lowest
priority will be executed first and highest priority will be
executed last.
syntax: @test(priority=2)
@test(priority=3,invocationCount=2)
priority can be a)bydefault=0 b)dublicate
c)+integer d)-integer
testNG will excute testmethods in alphabetical orders
c)enabled:
syntax: @test(enabled=false)
if you don’t want to executed scenario or test case at that time
we use enabled=false or we can say to skip an particular test
scenario we use enabled=false
d)depends on method:
syntax: @test(depends on methods={"beforetest2"})
dependency is a feature in testNG that allows a test method to
depend on single or group of test methods
e)timeout: if our class contains multiple methods and suppose
one of method needs

[Type here]
more time to execute than other methods, then by default
testnG will fail that method and it will send us timout exception

syntax: @test(timeout=5000)
45) we can give groups to the class level and
46)how to create test suit:
whenever you want to create test suit then right click on your
class and after that click on testNG option and say convert to
testng, once you click you will get one window where we have
to give location, suite name, and test name
47)so here you will get one .xml file that is nothing but test suit
here you can add classes from different packages or project
48)when we create test suit then we don’t need to run class,
we can run test suit directly
49) failed.xml: whenever your test cases gets failed at that time
one folder will be created in that failed.xml file will be created.
50)Extendable report: -
-This is third party tool installed into our project.
-Extended report which is used to make a report of executed
script and test suit (regression suit)
-after compilation of execution of test cases, email will be
triggered and report is directly sent to the email id.

[Type here]
51) GitHub: It is central repository to store test scripts, here you
can push and pull the code
52)Jenkins: it is continuous integration tool

[Type here]

You might also like