|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.easetech.easytest.loader.ExcelDataLoader
public class ExcelDataLoader
An implementation of Loader for the EXCEL(xls) based files. This Loader is responsible for reading a list of
xls based files and converting them into a data structure which is understandable by the EasyTest framework. It
expects the format of the Excel file to be like this :
testGetItems LibraryId itemType searchText
where testGetItems represents the name of the test method for which the test data is being defined,
<EMPTY CELL> 4 journal batman
<EMPTY CELL> 2 ebook spiderman
LibraryId itemType searchText represents the test data fields for the test method, and
4 journal batman (and 2 ebook spiderman) represents the actual test data to be passed to the test method.
Each row in the EXCEL file represents a single set of test data.
Note the leading <EMPTY CELL> in the test data row. It denotes that this cell does not contain any value.It tells the
framework that testGetItems is just a method name and does not have any value.
An Excel cannot have a blank line in between test data whether it is for a single test or for multiple tests.
The framework is capable of handling multiple test data for multiple test methods in a single Excel file.
Although a user can choose to define the test data in multiple files as well.
If you want to pass a Collection to the test method, just separate each instance with a ":". For eg. to pass
a list of Itemids , pass them as a colon separated list like this -> 12:34:5777:9090
| Field Summary | |
|---|---|
protected static org.slf4j.Logger |
LOG
An instance of logger associated with the test framework. |
| Fields inherited from interface org.easetech.easytest.loader.Loader |
|---|
ACTUAL_RESULT, AMPERSAND, COMMA, DOUBLE_QUOTE, DURATION, EMPTY_STRING, EXPECTED_RESULT, SINGLE_QUOTE, TEST_FAILED, TEST_PASSED, TEST_STATUS |
| Constructor Summary | |
|---|---|
ExcelDataLoader()
Default no arg constructor |
|
ExcelDataLoader(InputStream excelInputStream)
Construct a new ExcelDataLoader and also load the data. |
|
| Method Summary | |
|---|---|
Map<String,List<Map<String,Object>>> |
getData()
Method to get the data |
Map<String,List<Map<String,Object>>> |
loadData(Resource resource)
Main entry point for the Loader |
void |
writeData(Resource resource,
Map<String,List<Map<String,Object>>> actualData,
String... methodNames)
Write the data back to the file that is represented by the Resource instance |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final org.slf4j.Logger LOG
| Constructor Detail |
|---|
public ExcelDataLoader()
public ExcelDataLoader(InputStream excelInputStream)
throws IOException
excelInputStream - the input stream to load the data from
IOException - if an IO Exception occurs| Method Detail |
|---|
public Map<String,List<Map<String,Object>>> getData()
public Map<String,List<Map<String,Object>>> loadData(Resource resource)
loadData in interface Loaderresource - The resource to load the data from
public void writeData(Resource resource,
Map<String,List<Map<String,Object>>> actualData,
String... methodNames)
writeData in interface Loaderresource - the resource instance to which teh data needs to be writtenactualData - the actual data that needs to be writtenmethodNames - OPTIONAL names of methods for which the data needs to be written. If the method
names are not provided, then the data is written for all the test methods ofr which teh data is present
in the actualData parameter
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||