Module: Beaker::DSL::Outcomes
- Included in:
- Beaker::DSL
- Defined in:
- lib/beaker/dsl/outcomes.rb
Overview
This module includes dsl helpers for setting the state of a test case. They do not need inclusion if using third party test runner. The Exception classes that they raise however should be defined as other DSL helpers will raise them as needed. See individual DSL modules for their specific dependencies. A class that mixes in this module must have a method #logger which will yield an object that responds to #notify and #warn. NOTE: the interface to logger may change shortly and Logger should be consulted for the appropriate interface.
Simply these methods log a message and raise the appropriate Exception The exceptions are are caught by TestCase and are designed to allow some degree of freedom from the individual third party test runners that could be used.
Defined Under Namespace
Classes: FailTest, PassTest, PendingTest, SkipTest
Instance Method Summary collapse
-
#export(data) ⇒ Object
populate a TestCase's @exports[] with structured_data.
-
#fail_test(msg = nil) ⇒ Object
Raises FailTest Exception and logs an error message.
-
#pass_test(msg = nil) ⇒ Object
Raises PassTest Exception and logs a message.
-
#pending_test(msg = nil) ⇒ Object
Raises PendingTest Exception and logs an error message.
-
#skip_test(msg = nil) ⇒ Object
Raises SkipTest Exception and logs a message.
Instance Method Details
#export(data) ⇒ Object
populate a TestCase's @exports[] with structured_data
83 84 85 |
# File 'lib/beaker/dsl/outcomes.rb', line 83 def export(data) @exports << data end |
#fail_test(msg = nil) ⇒ Object
Raises FailTest Exception and logs an error message
40 41 42 43 44 45 |
# File 'lib/beaker/dsl/outcomes.rb', line 40 def fail_test msg = nil = ( msg, 'Failed' ) logger.warn( [, logger.pretty_backtrace].join("\n") ) raise( FailTest, ) end |
#pass_test(msg = nil) ⇒ Object
Raises PassTest Exception and logs a message
51 52 53 54 55 56 |
# File 'lib/beaker/dsl/outcomes.rb', line 51 def pass_test msg = nil = ( msg, 'Passed' ) logger.notify( ) raise( PassTest, ) end |
#pending_test(msg = nil) ⇒ Object
Raises PendingTest Exception and logs an error message
62 63 64 65 66 67 |
# File 'lib/beaker/dsl/outcomes.rb', line 62 def pending_test msg = nil = ( msg, 'is Pending' ) logger.warn( ) raise( PendingTest, ) end |
#skip_test(msg = nil) ⇒ Object
Raises SkipTest Exception and logs a message
73 74 75 76 77 78 |
# File 'lib/beaker/dsl/outcomes.rb', line 73 def skip_test msg = nil = ( msg, 'was Skipped' ) logger.notify( ) raise( SkipTest, ) end |