Steps that have been looped can be added to a report with the API.
Loops have a summary step, which logs how many iterations the loop has, how many of those iterations that passed or failed, and at which iteration the loop ended. The summary step may also contain a test, whose value may be the average values from all the iterations, an iteration you want to highlight, or anything else.
You may add iterations to the loop. You don't have to add every iteration. Each iteration in a loop as to be of the same type (Numeric limit tests, String value tests, Sequence calls, etc.), and have the same name as the loop summary step.
If the API is in Active mode, the number of iteration, how many passed or failed, and which iteration the loop ended on is set based on the iterations added to the loop. The iteration index is set as well. If these values have been set for the loop, they will not be overwritten.
Adding Loops
Start recording a loop by calling the StartLoop method on a SequenceCall. StartLoop takes a Step type as a generic type parameter, which will be the type of the steps in the loop. Valid types are
- SequenceCall
- NumericLimitStep
- StringValueStep
- PassFailStep
- GenericStep
- MessagePopupStep
- CallExeStep
The four parameters iterations, passed, failed, and ending index are optional. If these are not set and the API is in Active mode, they will be calculated based on the iterations added to the loop. In Import mode, they must be set.
Returned from StartLoop is the summary step, which you may add tests or other data to.
NumericLimitStep summaryStep = sequenceCall.StartLoop<NumericLimitStep>("NumericLimitLoopExample", 3, 2, 1, 3);
After calling StartLoop, all steps added to that SequenceCall will be added to the loop. You add steps normally
NumericLimitStep iteration1Step = sequenceCall.AddNumericLimitStep("NumericLimitLoopExample");
iteration1Step.AddTest(105, CompOperatorType.GE, 100, "Ohm");
or by specifying the index (the index is zero-based). You should either specify all indexes or no index, otherwise things might get messy.
NumericLimitStep iteration2Step = sequenceCall.AddNumericLimitStep("NumericLimitLoopExample", 1);
iteration2Step.AddTest(98, CompOperatorType.GE, 100, "Ohm");
When all steps have been added to the loop, call StopLoop on the same SequenceCall as you called StartLoop.
sequenceCall.StopLoop();
Code Example
NumericLimitStep summaryStep = sequenceCall.StartLoop<NumericLimitStep>("NumericLimitLoopExample", 3, 2, 1, 3);
NumericLimitStep iteration1Step = sequenceCall.AddNumericLimitStep("NumericLimitLoopExample");
iteration1Step.AddTest(105, CompOperatorType.GE, 100, "Ohm");
NumericLimitStep iteration2Step = sequenceCall.AddNumericLimitStep("NumericLimitLoopExample", 1);
iteration2Step.AddTest(98, CompOperatorType.GE, 100, "Ohm");
NumericLimitStep iteration3Step = sequenceCall.AddNumericLimitStep("NumericLimitLoopExample");
iteration3Step.AddTest(103, CompOperatorType.GE, 100, "Ohm");
sequenceCall.StopLoop();
Comments
0 comments
Please sign in to leave a comment.