cancel
Showing results for 
Search instead for 
Did you mean: 

Halting testrunner execution upon eventHandler exception

Highlighted
Occasional Contributor

Halting testrunner execution upon eventHandler exception

Context:

  • We use testrunner.bat to run large SoapUI projects.  
  • We use eventHandlers implemented as groovy scripts (e.g. TestRunListener.beforeRun).  

Current situation

  • Groovy code in eventHandlers may throw exceptions, but testrunner.bat keeps executing tests ayway.
  • Hours of lab time could be wasted by executing tests when a fundamental piece like an eventHandler is failing.

Desired situation

  • Want exceptions thrown within groovy eventHandlers to cause testrunner.bat to terminate gracefully.

Benefit

  • Avoid wasting hours of lab time executing tests that are doomed to fail because of problems in eventHandlers.

Pointers welcome!  Thanks,

 

Rob

2 REPLIES 2
Highlighted
Community Hero

Re: Halting testrunner execution upon eventHandler exception

Can you please show the sample listener code snippet which throws error and still continue?


Regards,
Rao.
Highlighted
Occasional Contributor

Re: Halting testrunner execution upon eventHandler exception

Sure.  Here's some TestSuiteRunListener.beforeRun code that throws an exception:

 

throw new Exception('boom!')

 

The project still runs the test even when that exception is thrown.  An exception in a project-level event handler means that setup failed, in which case the tests are doomed.   In a production environment involving hundreds or thousands of tests, a lot of lab time can be wasted running tests that shouldn't have run and human time wasted diagnosing failures actually caused by a failure in project setup.

 

See attached standalone project created with 1.7.0, which demonstrates the problem.

 

Is there an option to halt test execution if exceptions occur in an event handler?

 

 

 

Rob

New Here?
Join us and watch the welcome video:
Top Kudoed Authors