Package com.hp.lft.unittesting
Class UnitTestBase
java.lang.Object
com.hp.lft.unittesting.UnitTestBase
- Direct Known Subclasses:
TestNgUnitTestBase
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
This method is called by OpenText Functional Testing for Developers Eclipse templates to initialize the test class.protected void
This method is called by OpenText Functional Testing for Developers Eclipse templates to clean up the test class.Returns the collection of parameterized test parameter values extracted from data resource on OpenText Application Quality Management server.protected String
Returns the alternative class name that is used whenever framework errors occur.protected String
Returns the alternative test name that is used whenever framework errors occur.protected abstract String
Returns the class name.protected static ReportConfiguration
Returns the default report configuration.protected String
Returns the testing project class name.protected String
getFrameworkClassName
(boolean removeCaseChars) Returns the testing project class name.protected String
Returns the test method name.protected String
getFrameworkTestName
(boolean removeCaseChars) Returns the framework test name.protected ModifiableReportConfiguration
Returns theModifiableReportConfiguration
to use for this project.protected static ReportConfiguration
getReportConfigurationFromExternalPropertiesFile
(String propertiesFilePath) Returns the report configuration with values from the specified leanft.properties file.protected static ReportConfiguration
getReportConfigurationFromResourcesPropertiesFile
(String propertiesFileName) Returns the report configuration with values from the specified leanft.properties file in the resources folder.protected static ReportProvider
Returns theReportProvider
.protected ModifiableSDKConfiguration
Returns theModifiableSDKConfiguration
to use for this project.protected abstract String
Returns the test method name.protected void
protected void
parameterizedTestSetup
(String testName, String paramName) protected void
Sets theStatus
of the Reporter.protected void
protected void
This method is called by OpenText Functional Testing for Developers Eclipse templates for operations to run before each test method.protected void
This method is called by OpenText Functional Testing for Developers Eclipse templates for operations to run after each test method.protected void
-
Field Details
-
logger
protected static final com.hp.lft.common.logging.Logger logger
-
-
Constructor Details
-
UnitTestBase
public UnitTestBase()
-
-
Method Details
-
getReporter
Returns theReportProvider
.- Returns:
- the report provider instance
-
classSetup
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
- 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
-
testTearDown
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
Returns theModifiableSDKConfiguration
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 theSDKConfiguration
.- 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, IOExceptionReturns theModifiableReportConfiguration
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 theSDKConfiguration
.- 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
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
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
Returns the testing project class name.- Returns:
- the testing project class name.
-
getFrameworkClassName
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
Returns the test method name.- Returns:
- the test method name.
-
getFrameworkTestName
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
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
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
Returns the class name.- Returns:
- the class name.
-
getTestName
Returns the test method name.- Returns:
- the test method name.
-
setStatus
Sets theStatus
of the Reporter.- Parameters:
status
- the new report status
-
setStatus
Sets theStatus
of the Reporter and provides theThrowable
as the failure reason (relevant to Failed status only).- Parameters:
status
- the new report statusthrowable
- the failure reason
-