Sei sulla pagina 1di 3

FRAMEWORK

Framework is a collection of reusable components that make the overall test execution easy and
efficient.
Framework is a custom Tool which is designed By framework Developers , that Makes Automation
test Engineer Life Easy
FrameWork is well Organized Structure of Components, one Driver file will take care entire Batch
Execution without any manual interaction
Majorly, it comprises of 8 components.
They are as follows (clock-wise):
• Generic Lib :
• Page Object Repository:
• Test Data
• Resources
• TestScripts
• batchRunner
• HtmlReport
• Screenshots
1. Generics :
“Generics” is a library of classes and common testing annotation which contains re-usable methods
which can be used for any Project .
A UI framework generic library can comprise of the following basic classes/interfaces:
FileLib
All the methods related to reading/writing test data from an external source are stored,
Its is implemented using Apache POI & Properties
As per the Rule of the Automation, data should not be hardcoded within a test scripts , so in-order to
read the from Excel & properties File we do have FileLib
BaseClass : contains common Annotation , which is required in all the Test like
@BeforeSuite : used to Connect to Database , if project required DB connection
@beforeClass : used to Launch the Browser
@BeforeMethod : used to login to Application
@AfterMethod : used to logout from the Appliaction
@AfterClass : used to close the Browser
@AfterSuite : close the Db connection
WebDriverCommonLib
In this class , we store any operational methods related to webdriver, like intelligent wait mechanism,
waitforpagetoload(),waitforElemnetPresent(), select(), moveMouse() etc.,
ListenerImplementationClass
It’s implemented using testNG Listener feature which is used to take screenshot whenever test id
getting failed
2. Page Object Repository :
Page Object Repository helps us to store all WebElements locator like Xpath id , name etc , instead
of hard-coding them, which is against automation rule.
It makes modification and maintenance of objects/xpaths easy, when a HTML page . GUI layout
changes.
In order to develop a page object repository, we use java design patterns, namely
• POM
• Page Factory
Page Object Model is a well organized design pattern, where we can store all the web elements at a
PAGE level.
There are 3 main rules which must be followed while working with POM :
• Identify list of Pages available in Application & create a dedicated JAVA class for every page.
• All the elements will be identified using @findBy and @findBys annotations & store them in de
• Identify reusable business actions in a UI page and develop the libraries (methods to be used on
them) and store them in dedicated JAVA class.
• Make sure all the We Elements available in POM class should be private , so that test writer can’t
modify the locator from their test , inorder to accesses the specific elements will have public getters
methods
Page factory is an extended design pattern of POM which is used to execute and initialize elements
available in page class.
Syntax: PageClassName ObjName = PageFactory.initelements(driver, PageClassName.class)
3. Test Data :
As per the automation rule, test data should never be hard-coded.
Hence we maintain test Data that is required to run a test case on an external resource and feed it to
our automation test at run time.
There are 2 types of Data
1. CommonData
2. Test scripts Data
Common Data contains global data , which is common to all testScript & it’s should be placed on
.properties File, like
URL : by changing URL variable Value , we can run the Test in Any WEBSERVER like Stage ,
testing , production like server
UserNAme/Password : By changing credential , we can the Test in Any credentials
Browser : by changing browser variable Value , we can run the Test in Any BROWSER
There are 3 types of external resources where test data can be stored:
• Commondata.properties file
• Testdata.xls file
• Jdbc.jar
This makes the reusability, modification and maintenance of test related data easy.
All the data which is required to run the test should be placed in Excel File
4. Test Scripts
Test Scripts are collection of actions to be performed on a system under test.
As manual intervention should not happen in automation, we store test cases as test scripts in
TestNG classes for repetitive execution.
All the test scripts related to a module should be stored in a single package and the package name
should be <domainname>.<companyname>.<modulename>.<test>
All the Test are Automated using Generic Lib & Page Object Libraries
With the help of plug-ins like TestNG, we can execute all the test scripts together.
5. Test NG :
TestNG is a unit testing tool used to execute multiple test cases at a single time.
Batch execution can be achieved in TestNG using testng.xml file where we can specify groups,
suites, test cases, modules, exclusions etc.
6. Resources.jar :
This component contains all the third party and plug-ins which are required to run the tests.
This may include third party tools like
• Gecko driver which is required for working with latest version of firefox.
• IEDriverServer and ChromeDriverServer which enable us to work with multiple browsers.
7. Reports
Test reporting not only makes us aware of the status of the success or failure, but also helps in
finding out the potential bugs. , will also get to know the Stability of the Application
Soon after the test execution, TestNG generates two HTML reports which state the test execution
results.
8. Screenshots
In case of test case/ batch execution failure, we go for this mechanism to report where exactly, the
test case failed.
This screenshot mechanism can be used along with test reporting for test robustness.

Potrebbero piacerti anche