Creating Tests

The Workbench provides a number of useful utilities for creating and working with tests. This includes a wizard for creating a test file, templates for making individual tests, and various other utilities.

Creating a Test File

The Workbench contains a wizard for creating a new test file. Select a folder in your workspace, right-click, and choose New > Test File. This is shown in the following.

MUnit Tester

Writing Tests

After a test file has been created you need to write some tests. There is a template that makes this easy. A test consists of a Test expression that contains the input, the expected output, and a TestID. A typical test is shown below.

MUnit Tester

Test Utilities

The Workbench provides various warnings and utilities that help develop your tests. You get warnings if any test is missing a TestID. There are also quick fixes to repair these; Ctrl-1 shows the quick fix offerings.

Another useful feature is the Fix TestIDs choice from the source code popup. This carries out various checks on the tests. For example, it checks all the ids to see if any are duplicated, and if so, they are changed. Duplicates cause problems for the test output report. An example of fixing the TestIDs is shown below.

Fixing Tests