Skip to content

How‐to: Build a row test

Josef Pötzl edited this page Aug 26, 2023 · 2 revisions

For a row test you create a test procedure with parameters. The parameters are used by AccUnit for passing the test data. You set the test data above the procedure as a comment with the identifier AccUnit:Row(...). Each AccUnit:Row line is run as an independent test.

Example row test class

Option Compare Database
Option Explicit

'AccUnit:TestClass

Public Sub Setup()
'
End Sub

Public Sub Teardown()
'
End Sub

'AccUnit:Row(vbSunday, #1/1/2023#)
'AccUnit:Row(vbMonday, #1/1/2024#)
Public Sub MyFirstTest(ByVal Expected As VbDayOfWeek, ByVal DateToCheck As Date)

   Dim Actual As VbDayOfWeek
   
   Actual = Weekday(DateToCheck, vbSunday)
   
   Assert.That Actual, Iz.EqualTo(Expected)
   
End Sub