# Aborting a running testplan creates unhandled GUI error

**URL:** <https://forum.opentap.io/t/aborting-a-running-testplan-creates-unhandled-gui-error/90>\
**Category:** Technical\
**Tags:** ks8400-editor\
**Created:** [October 26, 2020, 3:16pm UTC](https://forum.opentap.io/t/aborting-a-running-testplan-creates-unhandled-gui-error/90 "2020-10-26T15:16:41Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![LXuser](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opentap.io/lxuser/32/145_2.png) [@LXuser](https://forum.opentap.io/u/LXuser)\
**Post date:** [October 26, 2020, 3:16pm UTC](https://forum.opentap.io/t/aborting-a-running-testplan-creates-unhandled-gui-error/90/1 "2020-10-26T15:16:41Z")

</div>

When a “Run program” step is aborted while the program to execute is open you get first this window:  
 ![Abort](https://us1.discourse-cdn.com/flex020/uploads/opentap/original/1X/f03c11f655d709de351030f9180c885397748ece.jpeg)

Pressing the Abort button twice (the first press does nothing) in this windows creates this log entry:  
 ![Abort2](https://us1.discourse-cdn.com/flex020/uploads/opentap/original/1X/4f459e8f9c63506e2c4e49531f31d0c244f55e8a.jpeg)

But the executed program is still open and TAP ist still running and seconds are counting.

Now youo can press abort again twice to see the same picture. The log error will apper only once.  
But the opened window never closes

If i then manually close the opened programm TAP shows the Aborted next to the step. This should have come immediately when pressing Abort i think.  
 ![Abort3](https://us1.discourse-cdn.com/flex020/uploads/opentap/original/1X/b7a31d91e9f0f7b774a71081eba1930f2c86c22b.jpeg)

---

<div class="post-metadata">

**Author:** ![brennen\_direnzo](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opentap.io/brennen_direnzo/32/6_2.png) [@brennen\_direnzo](https://forum.opentap.io/u/brennen_direnzo)\
**Post date:** [October 26, 2020, 3:30pm UTC](https://forum.opentap.io/t/aborting-a-running-testplan-creates-unhandled-gui-error/90/2 "2020-10-26T15:30:02Z")

</div>

> [@LXuser](#):
>
> But the executed program is still open and TAP ist still running and seconds are counting.
> 
> Now youo can press abort again twice to see the same picture. The log error will apper only once.  
> But the opened window never closes

This is due to the interaction with the program. A cancellation token exists, but if it isn’t handled by the external program the Test Plan does not know the current state. We want to avoid explicitly sending task kills as that could cause issues depending on the application.

The way Abort normally works is it waits for an “OfferBreak” event to occur so it can ensure the state of execution.

> <https://gitlab.com/OpenTAP/opentap/-/blob/master/sdk/Examples/PluginDevelopment/TestSteps/Step%20Execution/OfferBreakExample.cs>

---

<div class="post-metadata">

**Author:** ![LXuser](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opentap.io/lxuser/32/145_2.png) [@LXuser](https://forum.opentap.io/u/LXuser)\
**Post date:** [October 26, 2020, 3:46pm UTC](https://forum.opentap.io/t/aborting-a-running-testplan-creates-unhandled-gui-error/90/3 "2020-10-26T15:46:14Z")

</div>

I opended the onboard Packagemanager.exe.  
Perhaps handling the cancelation token can be integrated here easy.

---

<div class="post-metadata">

**Author:** ![brennen\_direnzo](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opentap.io/brennen_direnzo/32/6_2.png) [@brennen\_direnzo](https://forum.opentap.io/u/brennen_direnzo)\
**Post date:** [October 26, 2020, 3:52pm UTC](https://forum.opentap.io/t/aborting-a-running-testplan-creates-unhandled-gui-error/90/4 "2020-10-26T15:52:01Z")

</div>

I’m not sure what you mean by this. Can you explain a little more?

---

<div class="post-metadata">

**Author:** ![LXuser](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opentap.io/lxuser/32/145_2.png) [@LXuser](https://forum.opentap.io/u/LXuser)\
**Post date:** [October 26, 2020, 3:56pm UTC](https://forum.opentap.io/t/aborting-a-running-testplan-creates-unhandled-gui-error/90/5 "2020-10-26T15:56:01Z")

</div>

In the Test Step Settings i selected the Packagemanage which is part if OpenTAP:

 ![Package](https://us1.discourse-cdn.com/flex020/uploads/opentap/original/1X/024b5791ed2340f08462ac802d9dc6f317475a57.jpeg)  
 ![Settings](https://us1.discourse-cdn.com/flex020/uploads/opentap/original/1X/60cfb8986ab9a30281d2d79db1758a28465fde04.jpeg)

My idea was that the SW team that integrated the Cancelation Token in OpenTAP could modfy the PackageManager more easy than it would be if it is another company.

---

<div class="post-metadata">

**Author:** ![brennen\_direnzo](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opentap.io/brennen_direnzo/32/6_2.png) [@brennen\_direnzo](https://forum.opentap.io/u/brennen_direnzo)\
**Post date:** [October 26, 2020, 4:11pm UTC](https://forum.opentap.io/t/aborting-a-running-testplan-creates-unhandled-gui-error/90/6 "2020-10-26T16:11:54Z")

</div>

Ya, likely they could, but the Package Manager isn’t really an Application that make sense to use there.

---

<div class="post-metadata">

**Author:** ![LXuser](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opentap.io/lxuser/32/145_2.png) [@LXuser](https://forum.opentap.io/u/LXuser)\
**Post date:** [October 26, 2020, 4:27pm UTC](https://forum.opentap.io/t/aborting-a-running-testplan-creates-unhandled-gui-error/90/7 "2020-10-26T16:27:55Z")

</div>

i could create a testplan where user has to install the needed packages at start of testplan before an external sequence call is running that needs these packages.

---

<div class="post-metadata">

**Author:** ![brennen\_direnzo](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opentap.io/brennen_direnzo/32/6_2.png) [@brennen\_direnzo](https://forum.opentap.io/u/brennen_direnzo)\
**Post date:** [October 26, 2020, 4:44pm UTC](https://forum.opentap.io/t/aborting-a-running-testplan-creates-unhandled-gui-error/90/8 "2020-10-26T16:44:44Z")

</div>

All the objects are needed when the test step starts, so in some very specific cases you may be able to get this to work, but likely not in general. If you were sequencing test plans from a separate application/campaign manager, then you could do something like this, but I’d recommend using the REST API for that.

---

<div class="post-metadata">

**Author:** ![david-wsd](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opentap.io/david-wsd/32/204_2.png) [@david-wsd](https://forum.opentap.io/u/david-wsd)\
**Post date:** [October 27, 2020, 4:36pm UTC](https://forum.opentap.io/t/aborting-a-running-testplan-creates-unhandled-gui-error/90/9 "2020-10-27T16:36:48Z")

</div>

Regarding the stop/abort button, I think it would be great to have a visual indication that the button has already been pressed. Maybe it could change color.

Same for the open resources button.

---

<div class="post-metadata">

**Author:** ![brennen\_direnzo](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opentap.io/brennen_direnzo/32/6_2.png) [@brennen\_direnzo](https://forum.opentap.io/u/brennen_direnzo)\
**Post date:** [October 27, 2020, 5:43pm UTC](https://forum.opentap.io/t/aborting-a-running-testplan-creates-unhandled-gui-error/90/10 "2020-10-27T17:43:19Z")

</div>

@david-wsd I think this is a good compromise/improvement. We won’t be able to force an Abort (or an instrument to connect faster). But we can provide a better visual indication that we are waiting. Currently this can ger buried in the log. I will submit an inside for both.
