We receive quite a few questions through our Support channel involving how to data drive Selenium tests through Flood. There are many ways to achieve this - one of the simplest and most common ways of doing this is by using a simple CSV file structured with columns and rows of data that you would like to use within your test.
Could not load image
As you can see in the above example - we've got four different types of data needing to be used within a test - Username, Password, Name (Company), and Short Name (Company).
The first row always contains the Column Name - this is just to aid readability for this test.
To be able to use the CSV file we'll need a nice, easy to use specialised library that makes it very easy for us to use rows of data in sorted columns - I've chosen OpenCSV. OpenCSV is a great library that can be simply added into your existing Selenium script and start using straight away.
Simply add the OpenCSV declaration to the top of your script within the declared Java libraries section:
//Include OpenCSV library and Java File Reader
We now have to declare some string variables for the library. We have the nextLine string array and a FILE_PATH string variable that contains the path used by Flood for the CSV file.
//Declare file paths and associated variables used