Table of Contents

Class UnitTestBase

Namespace
HP.LFT.UnitTesting
Assembly
HP.LFT.UnitTesting.dll

The base class of the FTD Visual Studio template classes that are provided when creating a new test project.

public abstract class UnitTestBase : UnitTestSuiteBase
Inheritance
UnitTestBase
Derived
Inherited Members

Remarks

This class encapsulates all the functionality related to running tests and creating the HTML report.

Constructors

UnitTestBase()

protected UnitTestBase()

Properties

ALM

The default OpenText Application Quality Management data-source for data-driven tests. Use for NUnit 2.6x tests.

public IEnumerable<string[]> ALM { get; }

Property Value

IEnumerable<string[]>

ALMStatic

The static OpenText Application Quality Management data-source for data-driven tests. Use for NUnit 3.x tests.

public static IEnumerable<string[]> ALMStatic { get; }

Property Value

IEnumerable<string[]>

Reporter

Returns the Reporter of type IReporter used for reporting events.

public IReporter Reporter { get; }

Property Value

IReporter

Methods

GetAlternativeClassName()

Returns the alternative Class name that is used whenever framework errors occur.

protected virtual string GetAlternativeClassName()

Returns

string

The alternative test name.

Remarks

This can be useful to set the start and end points of a class in your project if the runner you are using does not successfully pass class names to the report.

In this case, by default the HTML report displays: [Undefined]. Override to provide an alternative test method name.

GetAlternativeTestName()

Returns the alternative Test name that is used whenever framework errors occur.

protected virtual string GetAlternativeTestName()

Returns

string

The alternative test name.

Remarks

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.

GetClassName()

This method is implemented in FTD Visual Studio templates to get the running class name provided by the selected framework (NUnit/MSTest) TestContext.

protected abstract string GetClassName()

Returns

string

The running class name.

GetFrameworkTestResult()

This method is implemented in FTD Visual Studio templates to get the running test/class status provided by the selected framework (NUnit/MSTest) TestContext.

protected abstract Status GetFrameworkTestResult()

Returns

Status

The running test status.

GetTestName()

This method is implemented in FTD Visual Studio templates to get the running test name provided by the selected framework (NUnit/MSTest) TestContext.

protected abstract string GetTestName()

Returns

string

The running test name.

GetTestParameters()

This method is implemented in FTD Visual Studio template to get the running test parameters provided by MSTest TestContext.

protected virtual DataRow GetTestParameters()

Returns

DataRow

The running test parameters.

TestSetUp()

This method is called by FTD Visual Studio templates' BasicSetUp, which runs before each test method.

protected void TestSetUp()

TestSuiteSetup(string)

This method is called by FTD Visual Studio templates' GlobalSetup to initialize the test class.

protected override void TestSuiteSetup(string frameworkWorkDir = null)

Parameters

frameworkWorkDir string

TestTearDown()

This method is called by FTD Visual Studio templates' BasicTearDown, which runs after each test method.

protected void TestTearDown()