Table of Contents

RDT00001: Test is not a Sub

Severity: Warning  ·  Family: RDT (RDCore.UnitTesting)  ·  Raised by: TestShapeAnalyzer

A Function or a Property is annotated as a test, or as the setup or cleanup of a module or of its tests.

Only a Sub runs as a test, and only a Sub runs as a module's '@ModuleInitialize, '@ModuleCleanup, '@TestInitialize or '@TestCleanup. A Function or a Property with one of these annotations never runs as one.

It is reported at the procedure's name.

How it is raised

Situation Example Resolution
A test that is a Function. '@TestMethod above Public Function AddsTwoNumbers() As Boolean. Make it a Sub, and check its result with Assert.
A setup procedure that is a Property. '@TestInitialize above Public Property Get Fixture() As Variant. Make it a Sub that sets up what the tests use.

See also