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.
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
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.
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
- The VI’s name must start with test
- The VI must have an #AST_Unit_Test bookmark on the block diagram
- 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.
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.