Presented By : Anshita Mathur QA Consultant Data Driven Framework in Selenium
Lack of etiquette and manners is a huge turn off. KnolX Etiquettes Punctuality Respect Knolx session timings, you are requested not to join sessions after a 5 minutes threshold post the session start time. Feedback Make sure to submit a constructive feedback for all sessions as it is very helpful for the presenter. Mute Please keep your window on mute Avoid Disturbance Avoid leaving your window unmuted after asking a question
Agenda 01 What is Data Driven Framework ? 02 Advantages of using DDT 04 Use of TestNG in DDT What is Apache POI library 03 05 Demo
What is Data Driven Framework ? ● Data Driven Framework is a testing strategy in which the data set under test, is stored separately from the test script ● It is used to drive test cases and suites from an external data feed. The data feed can be data sheets like xls, xlsx, and csv files ● To read or write an Excel, Apache provides a very famous library POI ● This library is capable enough to read and write both XLS and XLSX file format of Excel ● Data Driven Testing is also known as parameterized testing or table driven testing ● The TestNG framework helps us with a parameterization feature in which we can parameterize different test values and even keep our test data separate from our test scripts
There are two ways by which we can achieve parameterization in TestNG and they are as follows: ● With the help of Parameters annotation and TestNG XML file @Parameters({“name”, “searchKey”}) ● With the help of DataProvider annotation @DataProvider(name= “searchProvider”)
Why Data Driven Testing ? ➔ Testers frequently have multiple data sets for a single test ➔ Data driven testing helps keeping data separate from test scripts ➔ The same test scripts can be executed for different combinations of inputs ➔ Test data maintenance involving lot of human resources with lot of time and manual efforts For Example:
Benefits of using the Data Driven Testing Framework ➔ Automation Testing is driven by the data set under test ➔ Same test script will work for different data sets ➔ Faster Execution ➔ Less Maintenance ➔ Permits better error handling
Selenium Webdriver + Apache POI ● Selenium Webdriver does not support read and write operations on excel files, but it can be supported with the integration of third party tool i.e Apache POI ● Apache POI is an open source library to work with Microsoft Documents
Integrating Selenium Webdriver and Apache POI 1. Using Maven: ● Go to IDE and create a project ● Add the required dependencies for Apache POI 2. Using Jars: ● Go to poi.apache.org ● Download the Jar file ● Add this jar file in your project directory
Integrating Selenium Webdriver and Apache POI Add these Apache POI Dependencies in pom.xml file: <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>4.1.2</version> </dependency> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml</artifactId> <version>4.1.2</version> </dependency>
“The coordination between the main code and data set will be taken care by TestNG Data Providers, which is a library that comes as a part of the Apache POI files.”
TestNG ● TestNG is the framework created for executing unit tests and it is also used by the software testers to efficiently run the automated test scripts created in Selenium Webdriver ● TestNG allows users to perform data-driven testing ● This testing allows users to execute the same test multiple times with multiple sets of data.
Data Driven Testing using @DataProvider ● TestNG supports two ways for passing parameters directly to our Test Methods. ● We can pass parameters through Data Providers or an xml File. ● To achieve the data-driven testing, DataProvider feature is used. ● DataProvider is a data feeder method that executes the test method with multiple sets of data. ● Similar to TestNG Parameters, DataProviders are a means to pass data to test scripts in TestNG. ● Using DataProvider in TestNG, we can easily inject multiple values into the same test case. ● It comes inbuilt in TestNG and is popularly used in data-driven frameworks.
Add TestNG in your Project ● Add the TestNG Dependency in pom.xml file: <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>7.4.0</version> <scope>test</scope> </dependency> ● Or, we can add Jar file in project directory.
Types of MS Excel files
Demo
QA
Thank You !

Data Driven Framework in Selenium

  • 1.
    Presented By :Anshita Mathur QA Consultant Data Driven Framework in Selenium
  • 2.
    Lack of etiquetteand manners is a huge turn off. KnolX Etiquettes Punctuality Respect Knolx session timings, you are requested not to join sessions after a 5 minutes threshold post the session start time. Feedback Make sure to submit a constructive feedback for all sessions as it is very helpful for the presenter. Mute Please keep your window on mute Avoid Disturbance Avoid leaving your window unmuted after asking a question
  • 3.
    Agenda 01 What isData Driven Framework ? 02 Advantages of using DDT 04 Use of TestNG in DDT What is Apache POI library 03 05 Demo
  • 5.
    What is DataDriven Framework ? ● Data Driven Framework is a testing strategy in which the data set under test, is stored separately from the test script ● It is used to drive test cases and suites from an external data feed. The data feed can be data sheets like xls, xlsx, and csv files ● To read or write an Excel, Apache provides a very famous library POI ● This library is capable enough to read and write both XLS and XLSX file format of Excel ● Data Driven Testing is also known as parameterized testing or table driven testing ● The TestNG framework helps us with a parameterization feature in which we can parameterize different test values and even keep our test data separate from our test scripts
  • 6.
    There are twoways by which we can achieve parameterization in TestNG and they are as follows: ● With the help of Parameters annotation and TestNG XML file @Parameters({“name”, “searchKey”}) ● With the help of DataProvider annotation @DataProvider(name= “searchProvider”)
  • 7.
    Why Data DrivenTesting ? ➔ Testers frequently have multiple data sets for a single test ➔ Data driven testing helps keeping data separate from test scripts ➔ The same test scripts can be executed for different combinations of inputs ➔ Test data maintenance involving lot of human resources with lot of time and manual efforts For Example:
  • 8.
    Benefits of usingthe Data Driven Testing Framework ➔ Automation Testing is driven by the data set under test ➔ Same test script will work for different data sets ➔ Faster Execution ➔ Less Maintenance ➔ Permits better error handling
  • 9.
    Selenium Webdriver +Apache POI ● Selenium Webdriver does not support read and write operations on excel files, but it can be supported with the integration of third party tool i.e Apache POI ● Apache POI is an open source library to work with Microsoft Documents
  • 10.
    Integrating Selenium Webdriverand Apache POI 1. Using Maven: ● Go to IDE and create a project ● Add the required dependencies for Apache POI 2. Using Jars: ● Go to poi.apache.org ● Download the Jar file ● Add this jar file in your project directory
  • 11.
    Integrating Selenium Webdriverand Apache POI Add these Apache POI Dependencies in pom.xml file: <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>4.1.2</version> </dependency> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml</artifactId> <version>4.1.2</version> </dependency>
  • 12.
    “The coordination betweenthe main code and data set will be taken care by TestNG Data Providers, which is a library that comes as a part of the Apache POI files.”
  • 13.
    TestNG ● TestNG isthe framework created for executing unit tests and it is also used by the software testers to efficiently run the automated test scripts created in Selenium Webdriver ● TestNG allows users to perform data-driven testing ● This testing allows users to execute the same test multiple times with multiple sets of data.
  • 14.
    Data Driven Testingusing @DataProvider ● TestNG supports two ways for passing parameters directly to our Test Methods. ● We can pass parameters through Data Providers or an xml File. ● To achieve the data-driven testing, DataProvider feature is used. ● DataProvider is a data feeder method that executes the test method with multiple sets of data. ● Similar to TestNG Parameters, DataProviders are a means to pass data to test scripts in TestNG. ● Using DataProvider in TestNG, we can easily inject multiple values into the same test case. ● It comes inbuilt in TestNG and is popularly used in data-driven frameworks.
  • 15.
    Add TestNG inyour Project ● Add the TestNG Dependency in pom.xml file: <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>7.4.0</version> <scope>test</scope> </dependency> ● Or, we can add Jar file in project directory.
  • 17.
    Types of MSExcel files
  • 18.
  • 19.
  • 20.