DQMH 4.0 added a new productivity tool to create Unit Tests

The developer uses the Test Module API.vi to interact with the DQMH Public API and test it. This is very useful to verify that the DQMH module is working as expected. The developer can use the Test Module API.vi as a sniffer to verify that the module is working as expected when the application is running. While this is useful, it does not lend itself for automatic testing. If the developer wants to implement Test Driven Development (TDD), they would need to create their unit tests before they implement their Request events and Broadcast events.

This video shows how to create a DQMH Unit Test for an existing event.

bit.ly/CreateDQMHUnitTests

The following video shows how to implement Test Driven Development using DQMH Unit Tests.

bit.ly/TDDwithDQMH

Note: Developers do not need to be following TDD in order to use this feature. Developers could create Unit Tests for existing events by starting on step 3 on the list below.

The steps to introduce test driven development to DQMH are:

  1. Create the Request or Request and wait for Reply event, save all, do not implement the code just yet.
  2. Create the Broadcast event if necessary, save all, do not implement the code just yet.
  3. Create new Unit Tests
    1. Go to Tools>Delacor>DQMH>Testing Tools>New DQMH Unit Test…
    2. Select DQMH module for which you wish to create the unit test.
    3. Select the Request event you want to make a unit test for.
    4. Click the OK button and the unit test will be created.
    5. The New DQMH Unit Test adds the Unit Tests virtual folder to your project.
    6. If this is the first Unit Test created for this Module, then the New DQMH Unit Test utility creates three VIs
      • <Module Name> setup.vi
      • <Module Name> teardown.vi
      • Test - <Module Name> - <Request Name> <number>.vi
    1. If this is not the first Unit Test for this Module, then the New DQMH Unit Test utility creates only
      • Test - <Module Name> - <Request Name> <number>.vi

Note: There can be multiple unit tests for each Request event.

  1. Implement the Unit Test by following the instructions given by the #CodeNeeded bookmarks on the newly created test.
  2. The developer can choose their Unit Testing tool to run their new unit test. The New DQMH Unit Test utility is agnostic. Go to the help section for your tool
  1. If the developer has not implemented the code under test yet, the unit test should fail.
  2. Implement the event code needed in the DQMH Module Main and in the Test Module API.vi.
  3. Verify that the code works via the Test Module API.vi. Then run the unit tests and verify that those test pass as well.