Set Up TestStand With Jenkins

Updated Nov 1, 2023

Environment

Software

  • TestStand

Operating System

  • Windows

Other

  • Jenkins

Jenkins is an open-source automation server that is commonly used to perform Continuous Integration (CI) tasks, such as the building, testing, and delivery of an application. You may choose to use TestStand in combination with Jenkins or other CI systems for one or more of the following use cases:
 

By continuously testing and building your code, CI practices can help identify problems early in the development process. For example - consider a team that shares test development between several engineers. If a subVI is not checked into the shared repository, the test sequence will run with no problems on the original development machine, but when the team runs code from the repository, this sequence will have a broken VI. A problem like this could be caught immediately by a CI server and corrected, saving the team from last-minute troubleshooting.
 

TestStand can also be used as part of a larger CI system. For example - consider a mixed team of software and hardware engineers that are developing an embedded device. Unit tests can be written to test the embedded software, and TestStand sequences can be written to test hardware requirements and the software/hardware integration. TestStand can publish test results back to the same CI server as the software unit tests, allowing the entire team to adopt test-driven development and work together to resolve any failing tests.

Command Line Tools

The primary communication method between a CI server and a TestStand system is through the command line. The following TestStand utilities have command-line interfaces that can be used for this purpose
 

Hardware and Software Requirements

You will need a Windows computer or virtual machine on your network that can be used exclusively for building. It is not recommended to use this machine for software development purposes - doing so can cause copies of dependencies to exist in search directories that can be inadvertently pulled into a build. You will also need a licensed copy of all software and drivers required to build your test system.
 

Setting up a Build Machine for use with TestStand

  1. Set up a local administrator account for the build server and log on.
  2. Install all NI and 3rd party software required to build your test system.
  3. Since Jenkins runs as a service, no user dialogs can be shown during execution. If you plan on running any executions as part of your build or test process, modify the following TestStand properties to prevent dialogs from showing:
    1. Configure » Station Options » User Manager » Check User Privileges - uncheck this box to prevent the login dialog, alternatively - configure the system to automatically log on the Windows user.
    2. Configure » Station Options » Execution » On Run-Time Error - set this property to 'Run Cleanup.'
    3. Configure » Station Options » Time Limits - make sure none of these properties are set to "Prompt for Action."
    4. Configure » Station Options » Preferences - Uncheck the option to "Prompt to Find Files."
  4. Change the DCOM settings of the TestStand auto Manager (TSAutoMgr.exe) to Launching User.
    1. Open the Run Window (Win + R).
    2. Type dcomcnfg and press enter.
    3. Navigate to Component Services»Computers»My Computer»DCOM Config»NI TestStand AutoMgr.
    4. Right-click NI TestStand AutoMgr and select Properties.
    5. In the Identity tab, change the user account to The launching user.
  5. Note: The TestStand Version Selector can reset DCOM settings. If you intend to manage multiple TestStand versions on a single build machine, consider automatically setting this property via the RunAs registry key.
     

  6. Download and install the latest Jenkins Long Term Support (LTS) msi for Windows.
  7. When the installer is done running, it should automatically open up a web browser and navigate to 'http://localhost:8080/'.

Note: You will see HTTP Error 404 if the Jenkins service did not start properly. Port 8080 is the default port for LabVIEW web services and several other applications - if this port is already in use, Jenkins will not be able to start. To change the default port, open Jenkins.xml from the installation directory and modify the --httpPort attribute to an open port. If you still have problems starting the service, check the jenkins.err.log file in the installation directory for detailed error information.
 

  1. Before configuring Jenkins, configure the service to run as a local administrator account. Services run as the SYSTEM user by default, which can cause problems with the TestStand deployment utility.
    1. Press Win+R and type 'services.msc' to open services.
    2. Right-click on the Jenkins Service and choose 'Properties.'
    3. On the 'Log On' tab, choose 'This Account' and enter the local admin credentials.

  1. Press OK and restart the service.
  2. Navigate to the Jenkins URL: http://localhost:<port> 
  3. You will need to log in with the initial admin password, which should be given to you by Jenkins.
  4. Once logged in, you can install any plugins that you'd like. The Pipeline Plugin Suite is a good place to start.
  5. Create an initial admin user when prompted.
  6. Refer to the Jenkins User Documentation for more getting started information and best practices.