Table of Contents

13 Unit Test Structure

In general, we strive to make unit tests and work in a test driven way. But dependent on the project, the customer and the circumstances we don't force unit testing, we force the pragmatic approach. Find out more, how we test at HSE.

From all the unit testing frameworks, we decided to use Caraya from JKI.

How do we integrate unit tests in our project structure

Directory Structure

We have a separate LV project, to allow usage of conditional disable symbols. If the amount of tests is growing, it is useful to structure them in a clean way.

/<%project directory%>
/Tests                                     // All sorts of tests for the repo.
    /Unit Tests                            // Unit Tests for the source code.
        /UT_Unit-1                         // All unit tests for a library or class (//Unit-1//).
            UT_Library-1.lvlib             // Library for this logical collection of unit tests.
            UT_Library-1_Main.vi           // This VI executes all unit tests in this library.
            Test_<Description>.vi          // Test case for one or more related unit tests.
        /UT_Unit-2                         // All unit tests for a library or class (//Unit-2//).
        Unit_Tests_<project_name>.lvproj   // Project file for the unit tests.
        UT_Main.vi                         // Main unit testing VI. This VI executes all unit tests.

Project Structure