Testing and Validation - danielep71/VBA-PERFORMANCE_MANAGER GitHub Wiki
Testing and Validation
This page explains how to test and validate cPerformanceManager after import.
The class exposes multiple timing backends, session-bound validation logic, diagnostics, pause helpers, shared TW control, and structured checkpoint/reporting surfaces. A good validation approach therefore needs more than a single smoke test.
Testing goals
When testing cPerformanceManager, you usually want to answer these questions:
- Does the project compile cleanly?
- Does the class instantiate correctly?
- Do the core timing paths behave sensibly?
- Do invalid usage patterns fail or fall back as designed?
- Do environment-management features clean up correctly?
- Do checkpoint/reporting features behave correctly?
Start with a compile check
Before running any tests, make sure the project compiles:
- Open the VBA editor with
ALT + F11. - Select the target VBA project.
- Use
Debug > Compile VBAProject. - Repeat until the compile command is disabled or no errors remain.
Minimal smoke test
Option Explicit
Public Sub Test_Smoke_BasicTiming()
Dim cPM As cPerformanceManager
Dim ElapsedS As Double
Set cPM = New cPerformanceManager
cPM.StartTimer 5
cPM.Pause 0.05, 1
ElapsedS = cPM.ElapsedSeconds
Debug.Print "Smoke elapsed seconds: " & Format$(ElapsedS, "0.000000000")
cPM.ResetEnvironment
Set cPM = Nothing
End Sub
Recommended regression layer
The current repo includes a regression harness:
/test/M_cPM_TEST.bas
Use it when you want a broader validation pass after refactoring or release preparation.
The suite now covers:
- constructor/default state
- timing methods and session behavior
- formatted elapsed output
- strict vs non-strict behavior
- diagnostics and overhead helpers
- pause methods
- shared TW lifecycle
ResetEnvironmentidempotence- checkpoint / reporting behavior
Most important regression additions in the current suite
The latest regression layer includes direct tests for:
CheckpointbeforeStartTimerSetRunLabelbefore the first checkpointSetRunLabelrejection after the first checkpoint- default checkpoint naming when the supplied name is blank
CheckpointCountReportAsArrayReportAsTextClearCheckpointsStartTimerresetting checkpoint/report state
Recommended validation workflow
- compile the project
- run the smoke test
- run the regression suite
- inspect the Immediate Window summary
- inspect the dedicated worksheet regression log