Class CSVTestDataSource
- java.lang.Object
-
- net.thucydides.core.steps.stepdata.CSVTestDataSource
-
- All Implemented Interfaces:
TestDataSource
public class CSVTestDataSource extends Object implements TestDataSource
Test data from a CSV file.
-
-
Constructor Summary
Constructors Constructor Description CSVTestDataSource(String path)
CSVTestDataSource(String path, char separatorValue)
CSVTestDataSource(String path, char separatorValue, char quotechar, char escape)
CSVTestDataSource(List<String> paths, char separatorValue)
CSVTestDataSource(List<String> paths, char separatorValue, char quotechar, char escape, int skipLines)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <T> boolean
assignPropertyValue(T newObject, String property, String value)
protected <T> T
createNewInstanceOf(Class<T> clazz, Object... constructorArgs)
protected List<String[]>
getCSVDataFrom(Reader testDataReader)
List<Map<String,String>>
getData()
<T> List<T>
getDataAsInstancesOf(Class<T> clazz, Object... constructorArgs)
Returns the test data as a list of JavaBean instances.List<String>
getHeaders()
<T> List<T>
getInstanciatedInstancesFrom(Class<T> clazz, StepFactory factory)
protected List<Map<String,String>>
loadTestDataFrom(List<String[]> rows)
TestDataSource
separatedBy(char newSeparator)
static boolean
validTestDataPath(String path)
-
-
-
Constructor Detail
-
CSVTestDataSource
public CSVTestDataSource(List<String> paths, char separatorValue, char quotechar, char escape, int skipLines) throws IOException
- Throws:
IOException
-
CSVTestDataSource
public CSVTestDataSource(String path) throws IOException
- Throws:
IOException
-
CSVTestDataSource
public CSVTestDataSource(List<String> paths, char separatorValue) throws IOException
- Throws:
IOException
-
CSVTestDataSource
public CSVTestDataSource(String path, char separatorValue) throws IOException
- Throws:
IOException
-
CSVTestDataSource
public CSVTestDataSource(String path, char separatorValue, char quotechar, char escape) throws IOException
- Throws:
IOException
-
-
Method Detail
-
validTestDataPath
public static boolean validTestDataPath(String path)
-
getCSVDataFrom
protected List<String[]> getCSVDataFrom(Reader testDataReader) throws IOException
- Throws:
IOException
-
loadTestDataFrom
protected List<Map<String,String>> loadTestDataFrom(List<String[]> rows) throws IOException
- Throws:
IOException
-
getData
public List<Map<String,String>> getData()
- Specified by:
getData
in interfaceTestDataSource
-
getHeaders
public List<String> getHeaders()
- Specified by:
getHeaders
in interfaceTestDataSource
-
getDataAsInstancesOf
public <T> List<T> getDataAsInstancesOf(Class<T> clazz, Object... constructorArgs)
Returns the test data as a list of JavaBean instances.- Specified by:
getDataAsInstancesOf
in interfaceTestDataSource
-
getInstanciatedInstancesFrom
public <T> List<T> getInstanciatedInstancesFrom(Class<T> clazz, StepFactory factory)
- Specified by:
getInstanciatedInstancesFrom
in interfaceTestDataSource
-
separatedBy
public TestDataSource separatedBy(char newSeparator)
- Specified by:
separatedBy
in interfaceTestDataSource
-
-