Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

ETLUnit 3.9.6

 

Description

  • Annotation on a test method.
  • Causes an 'error' type of exception to be thrown from the test method. 
  • Will appear in the CLI as an ERR_UNSPECIFIED, unless the @Test annotation on the same test method has an attribute expected-error-id, with 'ERROR_UNSPECIFIED as its value.
  • @Error Throws an exception after the last executable line in the method executes.
  • If an error occurs during the method, causing it to stop and throw an error, that error will show in the log, but not on the command line. ERR_UNSPECIFIED will override whatever that error may be.
  • Useful for debugging.

Attributes

Attribute

Name

Required?

Possible

Values

Info
descriptionYes
  • A string
  • Provide description of the error.  The description written here will not appear in any of the logs.

Location in the test class file

Before a test method.

Examples

The following test will pass, because the error is "caught." 

The @Test annotation has an expected-error-id of 'ERR_UNSPECIFIED.'

 

@Error gets caught by @Test

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

@Error(description: 'Demonstration of the @Error annotation.')

executeError()

{

log(

message: 'Annotated with Error',

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

log-classifier: 'anyClassifier'

);

}


 

The following test will produce an error, because there is nothing to catch the error forced by the @Error annotation.

 

@Error does not get caught

@Test

@Error(description: 'Demonstration of the @Error annotation.')

executeError()

{

log(

message: 'Annotated with Error',

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

log-classifier: 'anyClassifier'

);

}


 

  • No labels

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.