The document discusses frameworks for testing and describes the key components of a testing framework including the base class, page object model, test cases layer, and advantages of using a framework. It also describes different types of frameworks, the initial setup process for creating a framework including dependencies, base package, and POM package, and how to fetch data, take screenshots, and generate reports.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
58 views8 pages
Framework
The document discusses frameworks for testing and describes the key components of a testing framework including the base class, page object model, test cases layer, and advantages of using a framework. It also describes different types of frameworks, the initial setup process for creating a framework including dependencies, base package, and POM package, and how to fetch data, take screenshots, and generate reports.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8
Framework: A framework is a set of rules that we can follow in a
systematic way to achieve desired results.
When we need to deal with many test cases, we will be using same information again and again; there comes the importance of frameworks. We can say any programming tool like JavaScript, Selenium etc are frameworks. We use them to write code in such a way that our task is completed efficiently with less efforts. In a framework we can have 3 sections like 1) Base class in which common code related to all the test cases can be written. 2) (Child of Base class) POM: Page Object Model This is an object repository where we can store element locator and its value so that we can just use a variable instead of element locator code (By.ID/CSS selector/XPATH etc.) 3) Test cases layer (Child of base class) in which we can write all the test cases Advantages of framework: Change of Requirements can be made easy Efficient and less code in test cases Reusability of code Less dependency Maintenance of code is easy Types of frameworks: 1) Data Driven Test Framework: All the required data will be kept aside in a doc and will be used in the framework from it. 2) Keyword Driven Test Framework: Keywords will be given to test cases and they will be maintained in an Excel sheet for easy maintenance. 3) Hybrid Test Framework: It is a combination of both Data Driven and Keyword Driven Test frameworks. A framework will have 3 phases: 1) Initial setup 2) Execution 3) Management Initial Setup: Step 1: we need to create a Maven Project – It is an automation tool mainly used to build Java projects. Using maven new projects can be created more easily and new Features created can be added easily. It also increases the performance of project and building process. Step 2: If we want to add some dependencies to our project we can just search it in browser and copy the dependency code and paste it in pom.xml file under the tag dependency. Initially required dependencies: 1) Selenium 2) TestNg 3) Apache Poi 4) Apache Poi- ooxml 5) Extent Reports 6) Common IOS 7) Log 4j Step 3: Creating a Base Package. In Src/test/java create Base package Create base class Src/test/java create environmentsetup create config.properties file Step 4: Creating POM Package Src/test/java create POMPackage create class Pomlogin Fetching Data from Excel Sheet(Data driven framework) We can also invoke data from Excel sheet to copy into our test cases using a method called ‘WorkbookFactory’. ScreenShots To take a screenshot we need to use an interface called ‘TakeScreenshot’ Generating HTML report: First we should create a .xml file and then edit the suite name, test name and class name; then execute the test run Testng suite and we can see the report in test-output folder.