Class DataSource
java.lang.Object
com.hp.lft.unittesting.datadriving.DataSource
- Direct Known Subclasses:
JunitDataSource
,TestNgDataSource
Class for enabling data-driving of parameterized tests.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the data table attached to the current test configuration when running a parameterized test from ALM.getOutputParametersData
(Object testClass, String methodName) Gets the output parameters data (name and value) if output parameters were defined for the test.static String
Saves data to a Json file and returns its path.
-
Constructor Details
-
DataSource
public DataSource()
-
-
Method Details
-
getDataTable
Gets the data table attached to the current test configuration when running a parameterized test from ALM.- Returns:
- : a collection of data rows, each represented by an array of strings.
- Throws:
DataSourceException
- if error occurs in Data Source Processing
-
getOutputParametersData
public static Map<String,String> getOutputParametersData(Object testClass, String methodName) throws DataSourceException Gets the output parameters data (name and value) if output parameters were defined for the test.- Parameters:
testClass
- : running test class.methodName
- : running test method.- Returns:
- : a map of output parameters names and values.
- Throws:
DataSourceException
- if error occurs in Data Source Processing
-
save
public static String save(Map<String, Object> data, String folderPath, String fileName) throws DataSourceExceptionSaves data to a Json file and returns its path.- Parameters:
data
- : data object to save.folderPath
- : path of target folder.fileName
- : name of Json file.- Returns:
- : string representing Json file path.
- Throws:
DataSourceException
- if error occurs in Data Source Processing
-