Perform a test/retest on specific steps in a Test Plan

Hi Everyone,

I am trying to achieve this requirement with my plugins, and have no clue on how to implement it so far.

Here is the requirement:
For example, I have telecoil test steps A and B. Test Step B is dependent on Test Step A.
If B fails, I would like to perform a retry on A and B without rerunning the whole test plan.

Is this possible through code using the OpenTAP framework?
I believe using the Keysight TAP GUI, there is an option to select “Run Selected Steps”. Can we do this achieve this behaviour through code instead of GUI?

2 Likes

Hello @antonio.quizon ,

You can use the parent/child approach. You can set your Test A to allow any child, then set your Test B as a child on Test A. Then on your Test A Run() implementation you can implement the retry, I have a 3 retries in the loop in the following example:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenTap;   // Use OpenTAP infrastructure/core components (log,TestStep definition, etc)

namespace OpenTap.Plugins.MyPlugin1
{
    [AllowAnyChild]
    [Display("Test A", Group: "OpenTap.Plugins.MyPlugin1", Description: "Insert description here")]
    public class Step : TestStep
    {
        #region Settings
        // ToDo: Add property here for each parameter the end user should be able to change.
        #endregion

        public Step()
        {
            // ToDo: Set default values for properties / settings.
        }

        public override void Run()
        {
            int RetryCount = 0;
            do
            {
                Verdict = Verdict.NotSet;

                // Execute this step - Test A
                // Test A implementation

                // Execute Child Step - Test B 
                RunChildSteps(); //If the step supports child steps.
            } while ((Verdict == Verdict.Fail) && (RetryCount++ < 3));

        }
    }
}

Here is what the execution looks like:

Here is the tap plan I ran on the screen shot above:
Child.TapPlan (1.1 KB)

Let me know if this helps you,

Carlos Montes

1 Like

Hi Carlos,

Thank you for your help! Is it possible to do it in a way without the parent/child relationship? Something similar to the “Run Selected Steps” using Keysight Editor GUI.

Just curious as we may have a requirement whereby the Test Steps A and B might not be in sequence i.e. there will be a Test Step X in between A and B.

Let me know if you have further doubts, thanks again for your help!

Best,
Miguel

Hi @antonio.quizon, how about making a parent step called “Repeat if Fail”. The step runs its children and if any of them failed, it tries again up to NumberOfTries, which is likely the only property it needs. I’m thinking this could be done in very few lines of code, and is something many of us might benefit from.

Now that I look more closely at @carlos.montes answer, I think I’ve basically repeated his proposal. :grinning_face_with_smiling_eyes:

The only difference is I’d suggest handling the repeats in a new generic parent step, rather than putting that functionality into your Test Step A. But I absolutely second the usage of parent-child relationship here.

Hi @david-wsd and @carlos.montes,

thanks for your answers! Let me try these approaches, and see if I can fulfil my requirements. Thanks again!

1 Like