About the TestID property

The TestID property is only used in Python scripts for PC Collect inspections. A unique TestID number is automatically assigned to each test in the inspection, but you can change this number to a more meaningful name.

 

Contents  [Hide]

 

Changing the TestID

The default TestID assigned to each test is a number, but you can change this property to a name that you find more useful. (Do not include any of these characters in the name:  <  >  &  '  " )

To return to the default TestID number, set this property to blank.

When referencing a named TestID in Python script, the TestID name must be surrounded by single quotes or double-quotes.

Example with named TestID:

if inspect.cursubi.ni("TransparentProductOnly").visible == True :
    inspect.cursubi.text("UserMessage").text = "Turn on Opacity tester and wait 8 minutes before measuring."

OnChange formula with TestID

When a test in the sub-inspection executes an OnChange formula, your Python script can check the testid variable to discover which TestID triggered the OnChange event.

Example with default TestID number:

if testid == 2: print "traceability changed"

if testid == 3: print "numeric input changed"

The Traceability test below has a TestID value of 2, indicating it was the third test to be added to the overall inspection. Once a TestID has been assigned to a test, that ID number is never reused in that inspection even if you delete that test or reorder the tests in the sub-inspection.

Displaying the TestID on test buttons

Displaying the TestID on test buttons in the Inspection Editor can serve as an easy reference when you want to program a Python script based on specific tests.

The option to display the TestID is set using the Inspection Editor Settings dialog. You can also choose how many tests you want to see at one time in the Editor.