National Instruments® TestStand (teststand.jar)

The NI TestStand launcher allows interfacing with TestStand sequences.



Configuration

The teststand.xml file is just a template and must NOT be edited. It's used by the system to build dynamically the form that the user will be able to fill in from the GUI when creating a custom execution configuration.


Parameter Description
General
Test root path This must indicate where are located all the TestStand sequences.
This is a root path. Each test in XStudio has a canonical path that will be appended to this path.
This path MUST not include an ending slash.

Default value is: C:\TestStand\tests
TestStand
Test runner path This must indicate where is located the sequence test runner.
Default value is: C:\Program Files (x86)\National Instruments\TestStand 2010 SP1\UserInterfaces\Simple\LabVIEW
Test runner This must indicate the name of the test runner you want to use.
The test runner can be either TestExec or SeqEdit.

Default value is: TestExec
Default entry point This must indicate the default entry point to run the sequence.
This setting will be overwritable per test case (see below).
Default value is: Single Pass
Default options This must indicate the default options to pass to the test runner.
This setting will be overwritable per test case (see below):
Default value is: /useExisting /editor /quit
Archive report path (Opt.) This optional parameter indicates where TestStands will store the HTML report for each testcase. This is a template that can include 2 optional tags "session_id# and #testcase_name# that will be replaced dynamically by their values.
Default value is: file://///shared_server/folder/#session_id#/#testcase_name#/#testcase_name#.html
Timeout (in seconds) This indicates how long the launcher will wait for a result from TestStand. If the .xml result file has still a size of 0 bytes after this timeout has elapsed (or a size continuously changing), the test is set as failed and the launcher will continue executing the next tests.
Default value is: 3600 (1 hour)
Initial delay to search for .xml (in seconds) This indicates the initial delay the launcher will wait before searching for the .xml result file. Indeed, when a test is started by the launcher, TestStand will setup its environment (which takes some time), then will create an empty .xml result file. Once the test is completed, the .xml result file is populated with all the data.
The launcher track the size of this .xml result file to check if the test is completed.
Default value is: 10


These values can be changed while creating the campaign session from XStudio.


Note about file path parameters:

Any parameter referring to a file or folder path (for instance Test root path) can be provided either using \ separator (if the tests are going to be executed on a Windows agent) or / separator (if the tests are going to be executed on a linux or MacOSX agent).

On windows, if you provide a path containing a, OS-localizable folder such as C:\Program Files, always prefer the English version (i.e. NOT C:\Programmes if you're using a french-localized Windows) or the corresponding native environment variable (i.e. %PROGRAMFILES%).




Process

With this launcher, all the test cases are executed independently and results and messages are retrieved for each from the unique results XML file generated by TestStand.


A test is executed by the launcher using this syntax:

"<testRunnerPath>\<testRunner>.exe" -runEntryPoint "<defaultEntryPoint>"
<testRootPath>\<testPath>\<testCaseName>.seq <defaultOptions>


This command is executed by the launcher from the following working directory: <testRunnerPath>


You can overwrite the default entry point per test case if you wish.
To do that, you just need to create in XStudio a test case param named "teststand.entrypoint", affect this param to each test case you want to use a specific entry point and give it a value.


You can also overwrite the default options to use per test case if you wish.
To do that, you just need to create in XStudio a test case param named "teststand.options", affect this param to each test case you want to use some specific options and give it a value.


Attachments

The files generated during test execution are uploaded to XStudio so that you can open/read them afterwards:
  • The XML result file generated by TestStand.
    This launcher will find this file by waiting an initial delay then searching for the most recent file matching this name pattern: <testCaseName>*.xml
    2 locations will be used to search for this file:
    • <testRootPath>\<testPath>\
    • <testRootPath>\<testPath>\Reports\


Results

The parsing is based on many node values and attributes that can be found in various location of the XML result file generated by TestStand.
Sequences can include subsequences. Hence, the parsing is fully recursive so that all the reporting levels are included with correct indentation.


The XStudio report can optionally include a click-able anchor pointing to the location of the corresponding archived HTML report as generated by TestStand itself.
This anchor will point to the url corresponding to the template you provided: i.e. file://///shared_server/folder/<session_id>/<testcase_name>/<testcase_name>.html.

Of course, if you do not provide the Archive reports folder (Opt.) path in your configuration, the anchor will not be displayed.

The action of archiving the report must be done by TestStand itself. TestStand can retrieve programmatically the path where the report needs to be copied by reading the content of the file <testRootPath>\testcaseName>.txt that is generated by the launcher itself. TestStand must delete this file after reading it.


Mapping

  • In XStudio you need to create a testcase for each main TestStand sequence file (without the .seq extension)
  • You can use arbitrary names for the tests that will contain the test cases but remember their canonical path is used to find the testcase's sequence.




Permissions

WARNING: if you're running your tests on Windows, it may be required to run the tests as administrator.
Having an account with Administrators permissions may even not be enough in some cases (especially if you're using Windows 10) and you may need to disable completely the UAC (User Access Control) on your computer.

To do so:
  • Press the Windows + R key combination
  • Type in regedit
  • Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
  • In the right-side pane, look for EnableLUA and set the value 0
  • Close the registry editor
  • Restart your computer



Debug

If your tests are not executed correctly or are reporting only failures, this is very likely because your configuration is incorrect or because you used a wrong naming convention for your tests and test cases.


The best way to quickly find out what's wrong is to look at the traces generated by XStudio (or XAgent).
The traces always include the detailed description of what the launcher performs (command line execution, script execution, API calling etc.) to run a test case. So, if you experiment some problems, the first thing to do is to activate the traces and look at what's happening when you run your tests.


Then, try to execute manually in a cmd box the exact same commands.
This will normally fail the same way.
At this point, you needs to figure out what has to be changed in these commands in order to have them run properly.

When you have something working, compare these commands to what's described in the Process chapter above. This will tell you exactly what you need to change.


Most of the time, this is related to:
  • some incorrect values in some parameters of your configuration,
  • the name of your tests,
  • the name of your test cases,
  • the canonical path of your tests