fi.jumi.api.drivers.SuiteNotifier Maven / Gradle / Ivy
// Copyright © 2011-2013, Esko Luontola
// This software is released under the Apache License 2.0.
// The license text is at http://www.apache.org/licenses/LICENSE-2.0
package fi.jumi.api.drivers;
public interface SuiteNotifier {
// TODO: support navigation by providing a Class or Method instance to the fireTestFound method
/**
* Notifies about the existence of a test.
*
* Must be called before starting the test.[1] Must be called with parent {@code testId} before any of
* its children.[2] Idempotent,[3] but the {@code name} must always be the same if called
* multiple times.[4]
*
* @reference [1]:
* onTestFound_must_be_called_before_onTestStarted
* @reference
[2]:
* parents_must_be_found_before_their_children
* @reference
[3]:
* removes_duplicate_onTestFound_events
* @reference
[4]:
* tests_must_be_found_always_with_the_same_name
*/
/* TODO: add javadoc after implemented:
IDEs can use the Class or Method object to implement code navigation.
*/
void fireTestFound(TestId testId, String name);
/**
* Notifies about the beginning of a test execution.
*
* May be called multiple times, before a test is {@linkplain TestNotifier#fireTestFinished() finished}, to produce
* nested tests.[1] The only limitation is that a nested test must be finished before the surrounding
* tests.[2]
*
* Everything printed to {@link System#out}[3] and {@link System#err}[4] after the call to
* this method[5] will be recorded from the current thread[6] and threads which are started by
* it[7] (possibly together with timestamps and name of the thread which printed it).
*
* @return a notifier for the events of the test execution that was just started.
* @reference [1]:
* notifies_about_the_beginning_and_end_of_a_run
* @reference
[2]:
* fireTestFinished_must_be_called_on_the_current_test
* @reference
[3]:
* captures_stdout &
* replaces_stdout_with_the_captured_stream
* @reference
[4]:
* captures_stderr &
* replaces_stderr_with_the_captured_stream
* @reference
[5]:
* captures_what_is_printed_during_a_run
* @reference
[6]:
* concurrent_captures_are_isolated_from_each_other
* @reference
[7]:
* captures_what_is_printed_in_spawned_threads
* @see TestNotifier#fireTestFinished()
*/
TestNotifier fireTestStarted(TestId testId);
/**
* Notifies about an internal error in the testing framework, i.e. not a {@linkplain TestNotifier#fireFailure test
* failure}.
*/
void fireInternalError(String message, Throwable cause);
}