Class DataSource

java.lang.Object
com.hp.lft.unittesting.datadriving.DataSource
Direct Known Subclasses:
JunitDataSource, TestNgDataSource

public abstract class DataSource extends Object
Class for enabling data-driving of parameterized tests.
  • Constructor Details

    • DataSource

      public DataSource()
  • Method Details

    • getDataTable

      public List<String[]> getDataTable() throws DataSourceException
      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 DataSourceException
      Saves 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