Example Programs

cancel
Showing results for 
Search instead for 
Did you mean: 

TestStand Notification Cross-Process Example in C#

Overview

This example demonstrates the ability for the TestStand engine to communicate through the Sync Manager with another instance of the TestStand engine. The first instance is created by a stand-alone application developed in C#. The second instance of the engine is used by TestStand to run a test sequence.
 

Description

The stand-alone application, a Windows forms application created in Microsoft Visual Studio with C#, uses the TestStand Engine and the Sync Manager class to create a TestStand Notifier. In the C# application, the notifier is created when the user begins the application. The notifier is named, "*MyNotification" in both TestStand and the C# application. When a synchronization object name begins with an asterisk, such as *MyNotification", multiple processes can share the reference to the object. 

In the C# application, the TestStand API is used to notify any process that is waiting on this specific notifier that an event has occurred, otherwise known as setting the notifier. This is executed when the user selects the Start button, and the Station Status displays "Ready..." on the C# application's user interface. When the user selects, Stop, the application will clear out the notifier, but the notifier will still exist.

 

Simultaneously, a separate TestStand execution waits on this notifier to be set by the user interface and informs the user when it has been set. The TestStand execution will terminate if the notifier object does not exist. Otherwise, when it has been set by the stand-alone application, the user will see a message pop-up indicating that the notifier has been set. 

 

Note: This example is applicable to situations where the test station is configured in a separate application or process from TestStand, and then informs TestStand when all test stations are ready.

 

Hardware and Software Requirements

  1. TestStand 2014 or compatible
  2. Microsoft Visual Studio 2013 or compatible
  3. .NET Framework 4.5 or later

 

Steps to Implement or Execute Code

  1. Open the solution, "TestStandNotifierExample.sln" in Microsoft Visual Studio and run the application.
  2. Open the TestStand sequence, "TestStandNotificationExample.seq" and execute the sequence, with either Single Pass or Test UUT. The sequence file will wait for the notifier to be set by the C# application.
  3. Click Start on the Windows form created by the C# application. The Station Status will display "Starting..." until the progress bar has filled. Once it has filled, the Station Status will display "Ready..." and the notifier will be set.
  4. The TestStand sequence will display a message pop-up notifying the user that the Notifier has been set, and the execution will then terminate.
  5. The user can clear out the notifier by selecting Stop on the Windows form. The Station Status will display "Stopping..." and the value of the progress bar will begin to decrease to zero. Once the progress bar has emptied out, the Station Status will display "Station Idle..." and the notifier will be cleared of its set state.

 

Contributors