From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW Unit Test Framework Toolkits suggestions

Hi All,

 

I looking for your suggestions.

 

My requirement is to perform below steps 1 & 2 automatically using CLI or any another possible scripts. Most probably I will be using Jenkin server for automation.

 

1. Run pre-defined unit tests on a VI

2. Parse the test report and extract the test pass/fail data

 

Which unit test framework is more suitable for this? NI Unit test framework? I'm more inclined towards this.

 

What would be the best approach here?

 

Thank you

0 Kudos
Message 1 of 3
(1,979 Views)

I use the RunUnitTests LabVIEW CLI operation: Predefined Command Line Operations 

 

It produces a JUnit file that you can parse to obtain the tests that passed and failed.

 

I use a similar step in Azure (YML):

parameters:
  testProject: '' # The .lvproj that holds the unit tests
  jUnitReportPath: $(Build.Repository.LocalPath)\report.xml
  portNumber: 3363
  logFilePath: '%temp%\labviewcli_log.txt'
  logToConsole: true
  verbosity: Detailed

steps:
- script: LabVIEWCLI -OperationName RunUnitTests -PortNumber ${{parameters.portNumber}} -LogFilePath "${{parameters.logFilePath}}" -LogToConsole "${{parameters.logToConsole}}" -Verbosity ${{parameters.verbosity}} -ProjectPath "${{parameters.testProject}}" -JUnitReportPath "${{parameters.jUnitReportPath}}"
  displayName: LabVIEWCLI UTF
- task: PublishTestResults@2
  inputs:
    testResultsFiles: '${{parameters.jUnitReportPath}}'

https://www.ni.com/samplecodelicense 

 

All the best,

Message 2 of 3
(1,895 Views)

I believe NI UTF, VI Tester, and Caraya all produce JUnit reports as outputs which can all be consumed by Jenkins (I don't know what you're looking to parse but it seems more typical to just display the results and fail the build if there were any errors which doesn't require any parsing on your end). The NI UTF has a built-in CLI step to run all tests for a project but other frameworks can do this by running a single VI through the LabVIEW CLI so I don't see this as a big selling point. 

 

I have heard of people integrating all of the above unit test frameworks with Jenkins so I would just go with the framework you like best for creating/maintaining unit tests which, for me, is usually Caraya.

Matt J | National Instruments | CLA
0 Kudos
Message 3 of 3
(1,888 Views)