Skip to content

How‐to: Run tests with AccUnit‐Loader (Access add‐in)

Josef Pötzl edited this page Aug 19, 2023 · 9 revisions

After the AccUnit Factory module with AccUnitLoader (Access add-in) has been inserted into the application under test, different variants can be used to start the tests by calling TestSuite.

Run all tests

  • TestSuite.AddFromVBProject.Run

AccUnit searches in VBProject of current application for classes, which were marked with 'AccUnit:TestClass as test class. In these classes all public methods are executed as test (exception: Setup and Teardown methods).

Run all tests of a single test class

  • TestSuite.Add(new MyTestClass).Run
  • TestSuite.AddByClassName("MyTestClass").Run In both variants, all tests (public methods) of the respective test class (TestFixture) are executed.

Run selected tests only

Filter by test name

  • TestSuite.<Any Add Methode>.SelectTests(<Method name filter>).Run

    Examples

    • TestSuite.AddByClassName("SqlToolsTests").SelectTests("DateToSqlText_*").Run

      All tests of the SqlToolsTests test class whose name starts with DateToSqlText_ are executed.

    • TestSuite.AddFromVBProject.SelectTests("*UseText*,*UseValues*").Run

    • TestSuite.AddFromVBProject.SelectTests(Array("*UseText*","*UseValues*")).Run

      All tests in all existing test classes that contain UseText or UseValues will be executed.

Filter by tag

  • TestSuite.<Any Add Methode>.Filter(<FilterTags>).Run

    Tag-Einstellung im Code

    • for the test class (TestFixture): 'AccUnit:TestClass:Tags("Tag name")
    • for a test: 'AccUnit:Tags("Tag name")
    • for a row test line: 'AccUnit:Row(<parameters>).Tags("Tag name")

    Examples

    • TestSuite.AddByClassName("SqlToolsTests").Filter("Null as argument").Run

      All tests from SqlToolsTests that have "Null as argument" set as tag will be executed.

    • TestSuite.AddByClassName("SqlToolsTests").Filter("Tag1,Tag2").Run

    • TestSuite.AddByClassName("SqlToolsTests").Filter(Array("Tag1", "Tag2")).Run

      Tests containing tag1 and tag2 are executed.

Clone this wiki locally