Get Started Logging to Databases Quickly with NI TestStand

Publish Date: Mar 25, 2014 | 16 Ratings | 4.81 out of 5 | Print | Submit your review


Welcome to an introduction to database logging using NI TestStand. Although a test report does a great job of providing a snapshot of the passes and failures of a particular test run, it isn’t convenient when you want to poll historical test results from one or many test stations. This short tutorial shows how NI TestStand can quickly log test results to your database out of the box.

Table of Contents

  1. Start Logging to a Database
  2. Adding Custom Results to the Database
  3. Additional Resources

For this tutorial, you will use one of the shipping examples included in the NI TestStand installation. This shipping example shows a Computer Motherboard Test that includes simulated NI LabVIEW code modules for testing a computer’s power supply, CPU, ROM, RAM, video, and keyboard. You can find this example sequence, shown in Figure 1, at <TestStand Public> Examples\Demo\LabVIEW\Computer Motherboard Test. Note that you can perform this tutorial with any sequence file that logs code module information.


Figure 1. Computer Motherboard Test Steps in the Main Sequence


1. Start Logging to a Database

To enable Database Logging, first select Configure»Results Processing from the pull-down menu. The Results Processing dialog gives you the option to enable logging to a report, database, or an offline file. (Note: In NI TestStand 2010 and earlier, you can find the database settings under Configure»Report Options.)

Figure 2. Pull-Down Menu Item for Results Processing


The Results Processing dialog shows the currently configured outputs for the results. To activate the default database logging, check the Enabled box as shown in the figure below and click OK.

Figure 3. Enabling Database Logging

Although NI TestStand can communicate with almost any open database connectivity (ODBC) system such as Oracle, SQL Server, or MySQL, it is also shipped with a Microsoft Access database so you don’t have to change any other default settings to start logging data.

To run the sequence file, select Execute»Single Pass from the pull-down menu. If you are using the Computer Motherboard Test example, you will see a Motherboard Test Simulator dialog. This gives an operator the ability to simulate failing test outputs from a number of components. For this example, check the Video and RAM to simulate a failed unit under test (UUT) and click OK.

Once this sequence has executed, a full set of data is logged to the database for one UUT. At the conclusion of the sequence, NI TestStand shows the ATML report, which was enabled by default. To see the results that were logged to the database, you’ll need to open up the Database Viewer.

To do this, navigate to the Results Processing dialog box and open the database options by clicking on the settings button to the right of the Database Output, as shown below.

Figure 4. Open the Results Processing window to view Database Options.


In this Database Options window, you can set a number of logging options, such as on-the-fly logging, database schemas, table statements, and table organization.

From the Data Link tab, you can select the type of database that will be used to store the data. You can also choose to view the data in the linked database by selecting View Data to launch the Database Viewer tool.

Figure 5. View the database from the Data Link tab.


The Database Viewer is a tool that displays the tables that make up this database schema. The tables are displayed in the tree on the left side. Figure 6 shows how the tables should appear.

Figure 6. You can view a particular table by right-clicking and choosing View Data.


To view the logged data from the execution that was run, right-click on the UUT_RESULT and select View Data. The resulting window displays the logged results for UUT_RESULT and the STATION_ID is located in the second column. You can also view the data for each step by right-clicking on the STEP_RESULT table and selecting View Data. In this case, you can find the failing results for the RAM and Video Tests and Diagnostics steps.

Figure 7. Database Log of Step Results From a Sequence Execution


Back to Top

2. Adding Custom Results to the Database

Although NI TestStand automatically logs each step’s limits, measured value, and many other fields, it is sometimes necessary to log additional information about a test to the database. One common example of this is when a complex test step returns a simple Boolean for pass or fail but there are other parameters of the test that also need to be logged.

For this example, there is a simulated Audio Test VI attached to this tutorial used to demonstrate this concept. In this case, it is important to record the resultant sound power level and the frequency used to test the UUT even though the test result is a Boolean.

After adding a Pass/Fail step and renaming it, select the Module tab of the Step Settings pane. Browse to the location of the Audio Test VI that you downloaded from this tutorial and select it. The image below shows the added test, Audio Test, in the sequence.


Figure 8. Computer Motherboard Test With Additional Audio Test Step


The parameters section of this tab gives you the ability to choose additional items to log to the report, database, or offline results file. Items that write to the Step.Result container are included in the logs by default. To add the Power level (dB) and Frequency parameters to the report and database logs, simply check the Log checkbox next to each as shown in Figure 9.


Figure 9. Audio Test Step Settings With Additional Logged Parameters


Now that the new code module is added, execute the sequence again using Single Pass and then open the Database Viewer or select F5 to refresh if you still have it open.

The database may not appear different at first glance because you have not altered the schema. If you view the STEP_RESULT table, however, you can see a new item was added by the new test step. If you open the PROP_RESULT table, you can scroll down to the number that accompanies the new test step and view logs of the two parameters. In the image below, you can see where these were logged to the database.

This data is linked to the Audio Test step through the ID in the STEP_RESULT column. This value is a unique identifier for the audio step in the STEP_RESULT table.

Figure 10. Additional Parameters as They Appear in the Log


Back to Top

3. Additional Resources

To continue learning about database logging with custom schemas in NI TestStand, visit Creating a TestStand Database Schema From Scratch.

To try NI TestStand, download the evaluation disk from

To learn about NI Alliance Partners with expertise in database management, visit

Back to Top

Bookmark & Share


Rate this document

Answered Your Question?
Yes No