-
Notifications
You must be signed in to change notification settings - Fork 4
How‐to: Build a simple unit test
Josef Pötzl edited this page Sep 1, 2024
·
2 revisions
- Create a new class module
- Mark the class as a test class with the comment text
'AccUnit:TestClass
- A public sub in this class is passed as a test
- The public sub Setup can be used as test preparation. This is called before each test.
- Public sub Teardown is run after each test.
Example test class
Option Compare Database
Option Explicit
'AccUnit:TestClass
Public Sub Setup()
' This procedure is called before each test
End Sub
Public Sub Teardown()
' This procedure is called after each test
End Sub
Public Sub MyFirstTest()
Const Expected As Long = vbMonday
Dim Actual As Long
Actual = Weekday(#1/1/2024#, vbSunday)
Assert.That Actual, Iz.EqualTo(Expected)
End Sub