ICustomTest

Lifecycle configuration

Configure #

Configure the harness to target a workbook and output sheet

Signature:

Public Sub Configure(ByVal targetWorkbook As workbook, _
                     Optional ByVal outputSheetName As String = vbNullString)

Parameters:

  • targetWorkbook: Workbook under test that collects printed output
  • outputSheetName: Optional worksheet name override

Release #

Release workbook references and reset state

Signature:

Public Sub ReleaseResources()

SetModuleName #

Store the VBA module name shown in output

Signature:

Public Sub SetModuleName(ByVal moduleName As String)

Parameters:

  • moduleName: Friendly module name

SetTestName #

Set the label used for the next test entry

Signature:

Public Sub SetTestName(ByVal testName As String)

Parameters:

  • testName: Descriptive test label

SetTestSubtitle #

Add a subtitle for the next test entry

Signature:

Public Sub SetTestSubtitle(ByVal testSubtitle As String)

Parameters:

  • testSubtitle: Additional context for the test

BeginTest #

Persist previous results and prepare a new checking instance

Signature:

Public Sub BeginTest(Optional ByVal resetNames As Boolean = False)

Reset #

Reset pending checking and accumulated results

Signature:

Public Sub ResetInstance()

Results

FlushCurrentTest #

Persist the current checking and retrieve all results

Signature:

Public Function FlushCurrentTest(Optional ByVal resetNames As Boolean = True) As BetterArray: End Function

Parameters:

  • resetNames: Optional Boolean specifying whether to reset names after clearing

Returns: BetterArray containing each Checking snapshot


Flush #

Persist the current checking without returning the result buffer

Signature:

Public Sub Flush(Optional ByVal resetNames As Boolean = True)

Parameters:

  • resetNames: Optional Boolean specifying whether to reset names after clearing

Results #

Clone accumulated results without modifying state

Signature:

Public Function Results() As BetterArray: End Function

Returns: BetterArray clone of the stored results


PrintResults #

Write accumulated results to the workbook

Signature:

Public Sub PrintResults(Optional ByVal outputSheetName As String = vbNullString)

Parameters:

  • outputSheetName: Optional worksheet name override

Assertions

AreEqual #

Compare expected and actual values and log the outcome

Signature:

Public Sub AreEqual(expected As Variant, _
                    actual As Variant, _
                    ByVal message As String)

Parameters:

  • expected: Expected value
  • actual: Actual value
  • message: Message describing the assertion context

AreNotEqual #

Confirm expected and actual values differ and log the outcome

Signature:

Public Sub AreNotEqual(expected As Variant, _
                       actual As Variant, _
                       ByVal message As String)

Parameters:

  • expected: Expected value
  • actual: Actual value
  • message: Message describing the assertion context

IsTrue #

Validate a boolean condition and log the outcome

Signature:

Public Sub IsTrue(ByVal condition As Boolean, ByVal message As String)

Parameters:

  • condition: Condition under test
  • message: Message describing the assertion context

IsFalse #

Validate that a boolean condition evaluates to False

Signature:

Public Sub IsFalse(ByVal condition As Boolean, ByVal message As String)

Parameters:

  • condition: Condition under test
  • message: Message describing the assertion context

ObjectExists #

Validate that an object is set and matches the expected type name

Signature:

Public Sub ObjectExists(ByVal instance As Object, _
                        ByVal expectedTypeName As String, _
                        ByVal message As String)

Parameters:

  • instance: Object reference to validate
  • expectedTypeName: Expected VBA type name
  • message: Message describing the assertion context

IsNothing #

Validate that an object reference is Nothing

Signature:

Public Sub IsNothing(ByVal instance As Object, ByVal message As String)

Parameters:

  • instance: Object reference to validate
  • message: Message describing the assertion context

IsNotNothing #

Validate that an object is not Nothing

Signature:

Public Sub IsNotNothing(ByVal instance As Object, ByVal message As String)

Parameters:

  • instance: Object reference to validate
  • message: Message describing the assertion context

LogFailure #

Log a failure message to the current checking

Signature:

Public Sub LogFailure(ByVal message As String)

Parameters:

  • message: Message describing the failure

Fail #

Log a failure message to the current checking; for compatibility purposes

Signature:

Public Sub Fail(ByVal message As String)

LogSuccesses #

Log a success message to the current checking

Signature:

Public Sub LogSuccesses(ByVal message As String)

Parameters:

  • message: Message describing the success