Class UnitTestBase

java.lang.Object
com.hp.lft.unittesting.UnitTestBase
Direct Known Subclasses:
TestNgUnitTestBase

public abstract class UnitTestBase extends Object
The base class of the OpenText Functional Testing for Developers Eclipse template classes provided when creating a new OpenText Functional Testing for Developers project.
  • Field Details

    • logger

      protected static final com.hp.lft.common.logging.Logger logger
  • Constructor Details

    • UnitTestBase

      public UnitTestBase()
  • Method Details

    • getReporter

      protected static ReportProvider getReporter()
      Returns the ReportProvider.
      Returns:
      the report provider instance
    • classSetup

      protected void classSetup() throws Exception
      This method is called by OpenText Functional Testing for Developers Eclipse templates to initialize the test class.
      Throws:
      Exception - if error occurs during classSetup
    • innerClassSetup

      protected void innerClassSetup() throws ReportException
      Throws:
      ReportException
    • classTearDown

      protected void classTearDown()
      This method is called by OpenText Functional Testing for Developers Eclipse templates to clean up the test class.
    • testSetup

      protected void testSetup()
      This method is called by OpenText Functional Testing for Developers Eclipse templates for operations to run before each test method.
    • parameterizedTestSetup

      protected void parameterizedTestSetup(String testName, String paramName)
    • testTearDown

      protected void testTearDown() throws DataSourceException
      This method is called by OpenText Functional Testing for Developers Eclipse templates for operations to run after each test method.
      Throws:
      DataSourceException - if error occurs in Data Source Processing
    • testTearDownNoThrow

      protected void testTearDownNoThrow()
    • getSDKConfiguration

      protected ModifiableSDKConfiguration getSDKConfiguration() throws URISyntaxException, IOException
      Returns the ModifiableSDKConfiguration to use for this project. By default, uses the SDK configuration details defined in the project's leanft.properties file.
      However, if an 'lftConfigFile' system variable was specified with a valid leanft.properties file, the SDK data from that file is used to initialize the SDKConfiguration.
      Returns:
      the ModifiableSDKConfiguration to use for this project
      Throws:
      URISyntaxException - if the syntax of the URI is invalid.
      IOException - if error occurs in I/O operations
    • getReportConfiguration

      protected ModifiableReportConfiguration getReportConfiguration() throws URISyntaxException, IOException
      Returns the ModifiableReportConfiguration to use for this project. By default, uses the Report configuration details defined in the project's leanft.properties file.
      However, if an 'lftConfigFile' system variable was specified with a valid leanft.properties file, the Report data from that file is used to initialize the SDKConfiguration.
      Returns:
      the ModifiableReportConfiguration to use for this project
      Throws:
      URISyntaxException - if the syntax of the URI is invalid.
      IOException - if error occurs in I/O operations
    • getAlmData

      protected static Iterable<String[]> getAlmData() throws Exception
      Returns the collection of parameterized test parameter values extracted from data resource on OpenText Application Quality Management server.
      Returns:
      the collection of parameterized test parameter values extracted from data resource on OpenText Application Quality Management server.
      Throws:
      Exception - if error occurs in the OpenText Application Quality Management Data process
    • getDefaultReportConfiguration

      protected static ReportConfiguration getDefaultReportConfiguration()
      Returns the default report configuration.
      Returns:
      the default report configuration.
    • getReportConfigurationFromResourcesPropertiesFile

      protected static ReportConfiguration getReportConfigurationFromResourcesPropertiesFile(String propertiesFileName) throws IOException
      Returns the report configuration with values from the specified leanft.properties file in the resources folder.
      Parameters:
      propertiesFileName - the name of the properties file to use (the file must be in the resources folder).
      Returns:
      the report configuration
      Throws:
      IOException - if error occurs in I/O operations
    • getReportConfigurationFromExternalPropertiesFile

      protected static ReportConfiguration getReportConfigurationFromExternalPropertiesFile(String propertiesFilePath) throws IOException
      Returns the report configuration with values from the specified leanft.properties file.
      Parameters:
      propertiesFilePath - the full path of the properties file to use.
      Returns:
      the report configuration
      Throws:
      IOException - if error occurs in I/O operations
    • getFrameworkClassName

      protected String getFrameworkClassName()
      Returns the testing project class name.
      Returns:
      the testing project class name.
    • getFrameworkClassName

      protected String getFrameworkClassName(boolean removeCaseChars)
      Returns the testing project class name. If an empty or null value is returned, use the alternative class name.
      Parameters:
      removeCaseChars - remove case characters
      Returns:
      the testing project class name.
    • getFrameworkTestName

      protected String getFrameworkTestName()
      Returns the test method name.
      Returns:
      the test method name.
    • getFrameworkTestName

      protected String getFrameworkTestName(boolean removeCaseChars)
      Returns the framework test name. If an empty or null value is returned, use the alternative framework name.
      Parameters:
      removeCaseChars - remove case characters
      Returns:
      the test framework name.
    • getAlternativeTestName

      protected String getAlternativeTestName()
      Returns the alternative test name that is used whenever framework errors occur.
      Note: This can be useful to set the start and end points of a test in your class if the runner you are using does not successfully pass test names to the report.
      In this case, by default the report displays: [Undefined]. Override to provide an alternative test method name.
      Returns:
      the alternative test name that is used whenever framework errors occur.
    • getAlternativeClassName

      protected String getAlternativeClassName()
      Returns the alternative class name that is used whenever framework errors occur.
      Note: This can be useful to set the start and end points of a test in your class if the runner you are using does not successfully pass test names to the report.
      In this case, by default the report displays: [Undefined]. Override to provide an alternative test method name.
      Returns:
      the alternative class name that is used whenever framework errors occur.
    • getClassName

      protected abstract String getClassName()
      Returns the class name.
      Returns:
      the class name.
    • getTestName

      protected abstract String getTestName()
      Returns the test method name.
      Returns:
      the test method name.
    • setStatus

      protected void setStatus(Status status)
      Sets the Status of the Reporter.
      Parameters:
      status - the new report status
    • setStatus

      protected void setStatus(Status status, Throwable throwable)
      Sets the Status of the Reporter and provides the Throwable as the failure reason (relevant to Failed status only).
      Parameters:
      status - the new report status
      throwable - the failure reason