0% found this document useful (0 votes)
2 views

Automation Test Framework

The document outlines the implementation and execution phases of an Automation Test Framework using Maven, TestNG, and Selenium. It details the setup process, including folder structure, configuration files, and the creation of page object classes, as well as the execution methods via command line and Jenkins. Additionally, it discusses common challenges in Selenium testing and introduces OOP concepts relevant to the automation framework.

Uploaded by

lakshmi_007
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Automation Test Framework

The document outlines the implementation and execution phases of an Automation Test Framework using Maven, TestNG, and Selenium. It details the setup process, including folder structure, configuration files, and the creation of page object classes, as well as the execution methods via command line and Jenkins. Additionally, it discusses common challenges in Selenium testing and introduces OOP concepts relevant to the automation framework.

Uploaded by

lakshmi_007
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

Automation Test Framework

Phase 1 – Implementation Part

Installing Maven through Eclipse Marketplace

After installed Maven, Check under Windows -> Preferences -> Maven installed
Folder Structure
Pom.xml

To get the dependency or piece of code: https://mvnrepository.com/


Creating Page Object Class

Creating Base class for common methods / variables


Creating Test Case 1
Logger Properties
Config.properties / ReadConfig.java files for having common variables to avoid the hard-coded.

Config.properties

ReadConfig.java
Changes in Base Class after done with Config.properties / ReadConfig.java files

Updating the Base class for desired browser (2 changes needed, 1. Base class , 2. Create an xml (testNG.xml) for the same)
testNG.xml file (should be in project level)

Adding extent report (pom, extent-config.xml (get it from internet),Reporting.java, testNG)


Capture Screenshots (SS) whenever needed for Pass / Failure (Method Implementation for SS)
Calling captureScreen() method for taking SS

Data Driven Test

Apache POI Jars / XLS test data file / XLSUtils.java are needed and @DataProvider annotation will be used for the same.
XLSUtils.java -> file will have all methods to access the excel file like set/get data, row/column count etc.,

@DataProvider annotation, @Test(dataProvider)


Runnaing Data Driven Test

Finding elements in another way


Sample test case 2 : adding new customer (Page Class)
Running All test cases Vs Failed alone (Refresh the root folder once, and check for testng-failed.xml file and run that xml alone)

So far, done with implementation part (i.e. Phase 1).

Phase 2: Execution Part

From Phase 2, the CI/CD is getting started.


How to execute the code, with / without seeing the code.

1. Running TC using pom.xml (need 2 plug-ins: 1. Complier, 2. surefire). Add <build> <plugins> <plugin>… after </Properties> and before <dependencies>

2. Using command prompt Maven CLI:


3. Using run.bat file to run test cases

4. Using Jenkins (2 methods: Freestyle(run.bat) & Maven(pom.xml))

Manage Jenkins -> Manage plug-ins-> Install all maven related plug-ins under Available tab
Manage Jenkins -> Global Tool Configuration -> Update JDK details like JAVA_HOME path
Continous Integration (CI)

Git Commands
Once Pushed the code, have to run the jenkins job for executing the tests. Select Git and update the URL of github, pom.xml, Build: clean install.

Selenium 4 features (SS of particular Web elements, new tab, new window, location;xy, hieght & width of an element, Locators)
Relative Locators
Some Info
The Most Common Selenium Challenges

• Dynamic Content
• Flakiness - False Positive and False Negative Results
• Mobile Testing
• Limited Reporting
• Multi-tab Testing
• Manual Testing - visual testing
• Scalability - Cross Browser Testing
• Pop-up Windows

Different types of popup and alerts occur while interacting with a web application, below are few listed:

• Browser level notification: Examples of such notifications can be; “Allow/Decline camera access,” “Allow/Decline
microphone access,” etc. These are browser level notifications that are handled in different ways depending upon the
browsers. For the Chrome browser, ChromeOptions can be used. Similarly, for the Firefox browser,
FirefoxOptions/FirefoxProfile can be used.

• Web-based alerts: Examples of such notifications can be; “This site says….”, “Do you want to leave this site” etc. These are
the alerts that can be handled using Selenium predefined class “Alerts,” which provide various methods like accept(),
dismiss(), etc.

• OS level pop-ups: Selenium capabilities are only bounded with web interaction; hence, handling OS level interactions is
something that can’t be performed using Selenium. These types of pop-ups can be categorized as flash objects which can’t
be accessed using Selenium Locators. “Robot” class is commonly used for interaction with such pop -ups.
https://www.softwaretestingmaterial.com/oops -concept-in-automation-framework/

• Concepts of OOPS in Selenium Automation Framework


o #1. ABSTRACTION
o #2. INTERFACE
o #3. INHERITANCE
o #4. POLYMORPHISM
▪ #1. METHOD OVERLOADING
▪ #2. METHOD OVERRIDING
o #5. ENCAPSULATION
• Other Selenium Automation Framework Concepts
o #1. WEB ELEMENT
o #2. WEBDRIVER
o #3. FIND BY
o #4. FIND ELEMENT

You might also like