Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Motivation:

Some people like their unit tests to fail on failure

Contact:

Ben Caradoc-Davies

Tracker:

http://jira.codehaus.org/browse/GEOT-2320

Tagline:

Excerpt

OnlineTestCase support for failure on failed connection

This page represents the current plan; for discussion please check the tracker link above.

Section
Column
width60%
Table of Contents
Column
Children Display

Description

OnlineTestCase provides infrastructure for configuring online test case fixtures. The current behaviour disables the test if an exception is thrown in the connect() method. It is proposed that an optional key be added to the test fixture property file to change this behaviour to failing if connect() fails.

From the javadoc (proposed code):

The default behaviour of this class is that if connect() throws an exception, the test
suite is disabled, causing each test to pass without being run. In addition, exceptions thrown by
disconnect() are ignored. This behaviour allows tests to be robust against transient
outages of online resources, but also means that local software failures in connect() or
disconnect() will be silent.

To have exceptions thrown by connect() and disconnect() cause tests to fail,
set skip.on.failure=false in the fixture property file. This restores the
traditional behaviour of unit tests, that is, that exceptions cause unit tests to fail.

Discussion

Announcement of this proposal, and following discussion:

Status

This proposal has been accepted. The implementation is complete.

Voting was:

Tasks

  • (tick) Update implementation (patch attached to Jira issue above).
  • (tick) Commit changes to subversion.
  • (tick) Update documentation.

Implementation Changes

The optional key skip.on.failure may be added to an OnlineTestCase fixture property file. For example:

Code Block
skip.on.failure = false

If this key is absent or set to true, the original behaviour is retained.

Documentation Changes

A note will be added to the testing page to record this optional behaviour: