Rapise - Data Driven Testing using the Spreadsheet object

June 9th, 2015 by inflectra

data-driven testing rapise excel

Many times, when testing, a tester will want the ability to run through many variations of the process recorded. This can be accomplished manually by running the test, then editing the test to use different data. The process of editing, rerunning, lather, rinse, repeat, gets very old after the first time. Plus this process is not very efficient with time and it can introduce issues through the slip of a finger. Enter Data-Driven Testing with the Spreadsheet Object

Wouldn't it be nice to gather our data ahead of time in a common format, and make it readily accessible? Your answer lies in the set of Global commands in the expandable spreadsheet section. With these commands you can attach to a file in a known location and cycle through the data. Once you can cycle through data it becomes possible to try all kinds of permutations and report accurately on the outcomes.

A couple of things to keep in mind as you use these commands...

  1. Please create the flow of the test, and test that flow, before you attempt to connect a spreadsheet. It is a real bummer when you have put in all the work only to find out that you forgot a few steps and your test just cycled through 500 bad flows. Build the test, test the test, verify the workflow, then start adding reams of data.
  2. Verify your data. Even if your flow works, if the data is bad, or malformed, the flow will likely fall down. Again 500 bad test runs do no one any good. Make sure your data is properly formed and makes sense for the work flow intended.
  3. Control your data. Good data placed in a very public area is a bad idea. Letting anyone go in and do what ifs does not allow you to verify the integrity of the data, let alone the test. A test with unknown data cannot meet a requirement. Keep your data in a safe area.
  4. Know where your data is. Your spreadsheets and data files should be contained in an area that is accessible to the test wherever it may be run from. If not the test will fail as a reliance on outside files does create a dependency and a weak link. The link is not so weak as to disturb the results or invalidate the quality of the test, but if that dependency chain is broken, the test will fail.

The commands available are listed here as well as available in the help file.

  • DoAttach(fileName, sheet) - allows Rapise to connect to a known spreadsheet defined as filename. This command also allows for the addressing of a particular named sheet within the file designated as sheet.
  • DoMoveToRow(rowInd) - once a sheet is attached this command allows you to move to a specific row of data based on its rowInd (RowID)
  • DoMoveToFirstRow() - regardless of previous positioning in the file, this will allow you to return to the first row of data, or the first row of the range if you have used SetRange
  • DoMoveToLastRow() - similar to DoMoveToFirstRow, only it moves to the last row of the sheet, or range if you have gone that route.
  • DoRandom() - oh so random. If a range is specified vi SetRange, this command will choose a row and column within the range at random. If SetRange is not in use it will choose amongst the default set, which is all the data.
  • DoSequential() - advances the row by one from the current position. This can work within the range as defined by SetRange or the default which is the whole set. Once the end of the range is reached this command will return to the first available row and return a false.
  • GetCell(columnId, rowId) - returns the value of a cell based on its column and row. If the parameters are not set it will return the current selected cells value after a DoSequential or DoRandom.
  • GetColumnCount() - returns the number of columns as a number
  • GetColumnName(ind) - based on the index this command will return the name of a column
  • GetCurrentRowIndex() - returns the index number of the currently selected row. This index is zero based.
  • GetEOF() - returns a true or false based on weather the current position is outside of the current spreadsheets range
  • GetRowCount() - counts the number of rows in a spreadsheet, returns a number
  • SetRange(startRow, endRow, startCol, endCol) - based on row and column, this command sets a range within a spreadsheet for use with DoRandom and DoSequential. Row and column indicators are numbers and are based on the index. End variables are optional.

Spira Helps You Deliver Quality Software, Faster and with Lower Risk.

Get Started with Spira for Free

And if you have any questions, please email or call us at +1 (202) 558-6885

Free Trial