com.hp.lft.unittesting.datadriving

Class DataSource

  • Direct Known Subclasses:
    JunitDataSource, TestNgDataSource


    public abstract class DataSource
    extends java.lang.Object
    Class for enabling data-driving of parameterized LeanFT tests.
    • Constructor Summary

      Constructor and Description
      DataSource() 
    • Method Summary

      Modifier and Type Method and Description
      java.util.List<java.lang.String[]> getDataTable()
      Gets the data table attached to the current test configuration when running a parameterized test from ALM.
      static java.util.Map<java.lang.String,java.lang.String> getOutputParametersData(java.lang.Object testClass, java.lang.String methodName)
      Gets the output parameters data (name and value) if output parameters were defined for the test.
      static java.lang.String save(java.util.Map<java.lang.String,java.lang.Object> data, java.lang.String folderPath, java.lang.String fileName)
      Saves data to a Json file and returns its path.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DataSource

        public DataSource()
    • Method Detail

      • getDataTable

        public java.util.List<java.lang.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 java.util.Map<java.lang.String,java.lang.String> getOutputParametersData(java.lang.Object testClass,
                                                                                               java.lang.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 java.lang.String save(java.util.Map<java.lang.String,java.lang.Object> data,
                                            java.lang.String folderPath,
                                            java.lang.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