Ways to execute code specifically when user aborts test execution

Class library usage, coding and language questions.
Ribbl
Posts: 5
Joined: Fri Sep 10, 2021 8:57 am

Ways to execute code specifically when user aborts test execution

Post by Ribbl » Fri Sep 10, 2021 9:04 am

I'm looking for a way to trigger a function call or just any bits of code (in my C# code module) once a user aborts a test execution (started by the assembly file, not within Studio) by either pressing the shortcut or closing the CMD.

The abort itself is recognized by Ranorex as it writes "The test run has been aborted by the user." into the report, so I'm wondering if there is a way to "listen" to that trigger and execute code based on it. I know about the TearDown option, but I want to execute code bits specifically on user abort, not after every execution generally. I've also seen theres a ThreadAbortException, but I'd rather not have a try catch block wrapping around my entire code module.

Jacob
Certified Professional
Certified Professional
Posts: 120
Joined: Mon Mar 22, 2021 10:01 pm

Re: Ways to execute code specifically when user aborts test execution

Post by Jacob » Fri Sep 17, 2021 11:19 pm

Hi Ribbl, welcome to the Ranorex Forums!

Unfortunately there is not a way to inject code into the Abort method as this is reserved for the system and, as such, there is no way to trigger additional code from within Ranorex. I would like to defer to the community to see if there are any additional thoughts on this matter, as there is quite the innovative bunch here.

--Jacob
Image