NI TestStand

Showing results for 
Search instead for 
Did you mean: 

PreBatch and PreBatchLoop not clear on the difference.

Go to solution



Working on a BatchModel and I am trying to get clear the difference between PreBatch and PreBatchLoop


  • PreBatch—Launches a dialog box to obtain the batch and UUT serial numbers.


  • PreBatchLoop—Before looping on a batch of UUTs, the process model calls the PreBatchLoop callback, which is empty in the process model file. Use the PreBatchLoop callback to perform an action before testing the batch.


I understand if I want to use my own Batch and UUT Serial system I create a callback in PreBatch, within which I can assess TestSocket data and enable / disable Test Sockets, unlike the PreUUT which runs for each enabled TestSocket.


How is PreBatchLoop intended to be used, is it simply If  I'm happy to use the default PreBatch but I want a couple of extra bits I place them in PreBatchLoop, but if I replace PreBatch with my own serial number system I can just but the extra bits in my own PreBatch and ignore PreBatchLoop ? or is there more to it.


Danny Thomson AshVire Ltd
0 Kudos
Message 1 of 2
Accepted by danny_t

PreBatch - this callback is called each time you go through the Batch Loop. When you execute a test by entering an Execution Entry Point (Like TestUUTs), your execution will enter what's called the Batch Loop, then display the default UUT Entry Pop Up for the user to enter in the DUT serial numbers and configure the test sockets. When that test finishes, the execution will go back to the top of the Batch Loop, show the UUT Entry Pop Up again, and allow the user to either start another test run (with the same or different UUTs), or exit - after which the execution will finish and display the report.


Inside the PreBatch override, you have access to read/write the ModelData and ModelPluginConfiguration objects before the batch run starts. You can use these to configure logging (Model Plugins), set data on your test sockets, etc.


PreBatchLoop - this callback is only called once per execution, it happens before the execution enters the Batch Loop. If you take a look at the BatchModel sequence file, you'll see when each of these callbacks is called by the process model


In PreBatchLoop, you also have access to the ModelPluginConfiguration object to configure result processing/recording, On-The-Fly settings, RunTimeVariables (just as in PreBatch), but you don't have access to the ModelData object.


In my experience, the vast majority of projects don't use the PreBatchLoop callback and just use the PreBatch callback. I would say that you would use the PreBatchLoop callback if you wanted to set up some model plugin information or configurations just once and have that information/configurations be shared across all batches run during the execution, as opposed to those configurations happening each time the Batch Loop iterates.

Systems Engineer
Testeract: Automated Test Specialists
Message 2 of 2