AST Unit Tester Review

I recently did a review of JKI VI Tester. While it is my goto unit testing tool, there are several issues with it:

  • You have to be an admin to install it.
  • It adds a ton of dependencies to your project.
  • If you have a project that has tests in it and you open it on a computer without VI Tester installed, it spends forever searching for all the dependencies.
  • You can’t run the test without VI Tester Installed.
  • For people who don’t understand OOP, it can be a challenge.

For all those reasons, Dan Shangraw of Automated SaftwareTechnology created the AST Unit Tester. I really like it because he has boiled unit testing down to the bare essentials and he did a very good job at. However, because it doesn’t have all the bells and whistles, I still prefer JKI VI Tester. I do still recommend AST tester to beginning LabVIEW programmers and people who are just starting out with unit testing because I like that it is super easy to learn.

Getting AST Tester

You can download and install AST Unit Tester via VI Package Manager.

Download and install AST Unit Tester via VIPM

Example Project

When you download AST Tester there is a sample project with a few tests in it to show you how the tester works. There is an example project located at <LabVIEW>\examples\Automated Software Technology\AST Unit Tester\AST Unit Tester Examples\AST Unit Tester Example.lvproj

This is the Example Project

It contains 3 Example Tests:

  • Passing
  • Failing
  • Error

As you can see below the tests are very simple. Since the tests don’t have any dependencies, it is very to share code with others. They can run each test individually without having the AST Unit Tester Installed.

Here is an example of a test that will pass.
Here is an example of a test that fails. In this case, the limits are wrong.
This example is used to show what happens when an error is generated by your test.

GUI

You can access the GUI to run the tests using the tools menu.

The GUI will automatically find any VIs in the project that meet 3 conditions

  1. The VI’s name must start with test
  2. The VI must have an #AST_Unit_Test bookmark on the block diagram
  3. The VI must have the correct connector pane.

Any VIs that it finds that meet the conditions will be listed as tests. The GUI then gives the user the option to run all the tests or to run an individual test. There are no other grouping options.

Running all of the example tests shows the results you would expect. Notice that the Test Error example does fail. There is no way to tell the difference between a test that simply failed and one that had an error.

Creating a New Test

To create a new test simply go to File>New and then select Test AST Unit TestTemplate.vit.

Using the CLI

One thing that the AST Unit Tester is missing is the ability to run it from the commandline as part of a CI or build process. I e-mailed Dan about this and he did provide me with a beta version of a VI for running tests programmatically. I have no idea if or when this will make it into the final product. If you want to see it, let Dan know. The more people who request it, the more likely it will make it into the official release.

3 Comments on “AST Unit Tester Review

  1. Hello Sam,

    I do have the VI to run the tests programmatically implemented. I also have a feature where the user can create a new test from the GUI.

    Thanks so much for your review!

Leave a Reply

Your email address will not be published. Required fields are marked *

*