Skip to content

A unit testing framework that supports both code coverage and test summary reports, designed for fast test discovery and execution speed.

License

Notifications You must be signed in to change notification settings

logmanoriginal/lvunit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors Forks Stargazers Issues BSD-3-Clause License


Logo

LVUnit

Unit testing framework for LabVIEW™
Explore the docs »

View Demo
Report Bug
Request Feature

About The Project

LVUnit is a unit testing framework for LabVIEW™.

Built With

Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

  • LabVIEW™ 2017 or later
  • VI Package Manager

Installation

  1. Clone the repo
    git clone https://github.com/logmanoriginal/lvunit.git
  2. Install packages
    start .vipc
    Or apply .vipc manually.

Usage

You can open Test Explorer from the Tools menu or via the Quick Drop Shortcut 'Ctrl+E'.

Test Explorer

Parameterized Tests (Theories)

Theories are test cases that can be executed with different data sets.

To create a theory, simply add controls to the connector pane.

Theory

To define data sets for your theory, place a JSON file with the same file name in the same folder as the test case.

For example:

  • Theory1.vi
  • Theory1.json

The JSON file has the following syntax:

[
  {
    "name": "Message 1",
    "data": {
      "expected": "Failed asserting that...",
      "message": "Failed asserting that..."
    }
  },
  {
    "name": "Message 2",
    "data": {
      "expected": "Test failed!",
      "message": "Test failed!"
    }
  }
]

Use Test Explorer to discover and execute all theories in your project. Notice that an entry is added for each data set in your theory.

Test Explorer

Advanced Features

  • LVUnit can be used from LabVIEW CLI to generate test and coverage reports from your CI/CD pipeline. See the Test operation in the Toolchain directory for a working example.
  • You can open a test case directly from Test Explorer by double-clicking on the test case in the tree. For theories, you need to double-click on one of its data sets. This will populate the theory with the selected data set for your convenience.
  • Test Explorer categorizes test cases based on their qualified name. You can place test cases in project libraries and Test Explorer will categorize them accordingly.
  • Test cases must be public. You can disable a test case by changing the scope (or the scope of its parent) to private.
  • Test cases that return an error at the error output terminal are considered failed. This includes any error that isn't a result of an assertion.
  • Test Explorer automatically discovers tests in your project. When you select a different project, Test Explorer scans the new project automatically.
  • Test Explorer supports code coverage. You can export code coverage data to a Covertura XML file. Note, however, that code coverage in LabVIEW is very limited and does not work right for VIMs, polymorphic VIs, and various other file types. Code coverage is reported as "lines" (because Cobertura has no concept for nodes) where the coverage percentage is reported as x/100 lines. This is a quick hack that is likely to change in the future. Use code coverage with caution. See the build pipeline for LVUnit for an example of how code coverage reports can be integrated into an CI/CD pipeline.

Roadmap

See open issues for a list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place. Any contributions you make are greatly appreciated 💖

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Keep in mind that LabVIEW™ VIs are binary files, which are difficult to merge.

  • Only change a single VI or library.
  • Avoid conflicts with other pull requests (don't work on the same libraries or VIs).
  • Send VI Snippets (via issues) instead of pull requests when possible.

License

Distributed under the BSD-3-Clause license. See LICENSE for more information.

Contact

Project Link: https://github.com/logmanoriginal/lvunit

Acknowledgements

About

A unit testing framework that supports both code coverage and test summary reports, designed for fast test discovery and execution speed.

Topics

Resources

License

Stars

Watchers

Forks