Pause a running test plan in TestStep.Run method

Hi
How can I Pause a running test plan in TestStep.Run method? I mean pause not abort.
In Keysight Test Automation Community edition there is a Pause button which works fine for me. How can I call the OfferBreak method to pause running test plan.

3 Likes

@teder.ted here is an example for using OfferBreak:

You can also find some more complex examples in our Unit Tests:

1 Like

Thanks, but OfferBreak() doesn’t work in Keysight Test Automation Community Edition GUI!?!

@teder.ted OfferBreak should work just fine there, but what it does is check to see if pause/abort has been clicking the GUI. If not, it will continue to execute.

Can you help explain what you are trying to do here? Is it a set amount of time you want to wait for? A prompt you want the user to acknowledge?

Any details on what will trigger the pause, and how the user would continue would be helpful and then we can provide you with a suggestion on how to best implement it.

Thanks for the replay.
At the beginning of all TestStep.Run methods I check whether DUT is yet connected or not. If disconnected I want to prompt user and pause (not abort) the test plan run by code. User may connect the DUT (e.g. reconnecting the cable to the DUT) then resume the test plan run.
We may solve the problem by raising an event when DUT connection failed and do not check the connection in each test step. Is OpenTAP capable of that and how?

Are you aware of the UserInput Control? That can I believe everything you are looking for with the pause, user prompt, and wait until response to continue:

First of all I appreciate your help.
UserInput looks like a good way for prompting the user. However the issue of pausing the test plan from a test step (in code) is still remained.
I mean something like TapThread.Current.Pause() which off-coarse doesn’t exist.

1 Like

Correct, that does not exist explicitly. UserInput does more of a “block” where execution waits for a user response, but it does not actually put the TestPlan into a “Pause” state like when the Pause button is clicked.

Using TapThread.Sleep(TimeSpan.FromSeconds(DelaySecs)); also would do something similiar.

You asked about events, which you could certainly create. In most cases people use the OnPropertyChanged event which exists for every TestStep.

For Pause specifically, I’ve submitted an issue here:

1 Like