Unit Testing

The Test Explorer helps you create, run, and manage unit tests with minimal boilerplate. Just add a test module and test stub through the UI, write your test using Rubberduck's Assert or PermissiveAssert API, and run it.

Rubberduck uses annotations (special comments), to discover the test modules and methods in your VBA project.

Procedures marked with the '@ModuleInitialize and '@ModuleCleanup annotations run respectively before and after the tests in a module are executed; methods marked with the '@TestInitialize and '@TestCleanup annotations run before and after each test, respectively.

Test methods only need to be public, parameterless, and marked with the '@TestMethod annotation. Tests can be ignored using the '@IgnoreTest annotation, and the module as a whole is marked as a test module with the '@TestModule annotation.

Test Explorer