Software QA & Testing Videos

Data Driven Testing Video Tutorial

Written by Zenergy | Feb 28, 2018 7:28:12 PM

Automation engineers, Chris Lawson and Ryan Eisma, share one method of data driven testing while utilizing different data sets.

 
 

“Sometimes, when writing a script you have a plethora of data elements that you want to feed into your script from an external locator or external source.” – Automation expert, Chris Lawson

How do you address this goal of feeding those data elements into your script from an external locator or source?

 

3 Step Method to Data Driven Testing

For this video we created a code example to read the Excel file and created an Excel spreadsheet with the basic inputs. (i.e. in the example from the video you will see a simple spreadsheet with 2 basic inputs and 2 rows of data, show in 3 columns).

 
 
 
  • (00:49) Step 1: First, point the class toward the file path. To do so, you’re going to want to store that in a variable to be used in the test. To store that variable you are going to use the file input stream class to create a new instance of a file and load up that path.
 
 
  • (1:08) Step 2: Then you are going to use the class provided by Java, called the XSSFWorkbook, to create a new instance of that class. Once you have done that you can load your file into the class.
 
 
  • Step 3: Now, you are going to use the sheet class and load up a new sheet to essentially build a virtual version of the Microsoft Excel file. (1:40) To do this you are going to point it at “sheet zero(0)”; since it is the first sheet in our class and it’s a zero(0) index. Then, create a new row and cycle through the rows. (01:30 – 2:10) In the video example, Ryan Eisma, does this by creating a simple array that can store the rows and columns of data. Then cycle through the end of that last row and column and store each of the values it is getting from Excel into that array. Once you have your data stored in the array you can manipulate that data and pass it into your test any way that you think is best or works for you.

Keep in mind there are various methods out there for data driven testing or driving tests while using different data sets; we hope you find this one helpful. If you have any further questions please contact us at contact@zenergytechnologies.com.

>> Subscribe to Zenergy on Youtube for more videos

 

Are you making BIG mistakes in your Selenium implementations?

Read our blog, Five Common Missteps in Selenium Test Automation Implementations.