06-13-2020 05:49 AM
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
06-23-2020 01:38 PM
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,
06-23-2020 02:09 PM
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.