die

ETLUnit 3.9.6

 

Draft in Progress

This document is a draft and is under development.

 

Description

  • Causes an error to be thrown from the test method.

Examples

If not caught, you will see ERR_UNCAUGHT_EXCEPTION in the ETLUnit Command Line Interface.

 

die() when the @Test annotation does not catch the error

@Test

forceError(){

log(

message: 'This test is going nowhere',

log-file-name: 'forceError.log',

log-classifier: 'standard-out'

);

die();

}

 

 

userme > te #forceError
Processing [1] tests
class experiment.test_me   -------------------------------------------------------
1/1        .forceError
      ERR_UNCAUGHT_EXCEPTION
  Caused an error                                                             E[1]
Tests run: 1, Errors: 1, Time elapsed: 0.272 sec

 

 

You may also see ERR_UNCAUGHT_EXZCEPTION on the statistics report, by the failed method's name.

 

userme > r

 

 

 

 

 

 

The error caused by the die() operation can be caught by including the error ID on the @Test annotation.

 

die() when the @Test annotation catches the error

@Test(expected-error-id:'ERR_UNCAUGHT_EXCEPTION')

forceError(){

log(

message: 'This test is going nowhere',

log-file-name: 'forceError.log',

log-classifier: 'standard-out'

);

die();

}

 

 

userme > te #forceError
Processing [1] tests
class experiment.test_me   -------------------------------------------------------
1/1        .forceError
  Passed                                                                      P[1]
Tests run: 1, Successes: 1, Time elapsed: 0.186 sec