|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jbehave.scenario.reporters.PrintStreamScenarioReporter
public class PrintStreamScenarioReporter
Scenario reporter that outputs to a PrintStream, defaulting to System.out.
The output of the reported event is also configurable via two other means:
Let's look at example of providing custom output patterns, e.g. for the
failed event.
we'd need to provide the custom pattern, say we want to have something like
"(step being executed) <<< FAILED", keyed on the method name:
Properties patterns = new Properties();
patterns.setProperty("failed", "{0} <<< {1}");
The pattern is by default processed and formatted by the
MessageFormat. Both the #format() and
#lookupPattern() methods are overrideable and a different formatter
or pattern lookup can be used by subclasses.
If the keyword "FAILED" (or any other keyword used by the reporter) needs to
be expressed in a different language, all we need to do is to provide an
instance of I18nKeyWords using the appropriate Locale, e.g.
KeyWords keywords = new I18nKeyWords(new Locale("it");
| Constructor Summary | |
|---|---|
PrintStreamScenarioReporter()
|
|
PrintStreamScenarioReporter(KeyWords keywords)
|
|
PrintStreamScenarioReporter(java.io.PrintStream output)
|
|
PrintStreamScenarioReporter(java.io.PrintStream output,
java.util.Properties outputPatterns,
KeyWords keywords,
boolean reportErrors)
|
|
PrintStreamScenarioReporter(java.util.Properties outputPatterns)
|
|
| Method Summary | |
|---|---|
void |
afterScenario()
|
void |
afterStory()
|
void |
beforeScenario(java.lang.String title)
|
void |
beforeStory(Blurb blurb)
|
void |
examplesTable(ExamplesTable table)
|
void |
examplesTableRow(java.util.Map<java.lang.String,java.lang.String> tableRow)
|
void |
failed(java.lang.String step,
java.lang.Throwable cause)
|
protected java.lang.String |
format(java.lang.String key,
java.lang.String defaultPattern,
java.lang.Object... args)
Formats event output by key, conventionally equal to the method name. |
void |
givenScenarios(java.util.List<java.lang.String> givenScenarios)
|
protected java.lang.String |
lookupPattern(java.lang.String key,
java.lang.String defaultPattern)
Looks up the format pattern for the event output by key, conventionally equal to the method name. |
void |
notPerformed(java.lang.String step)
|
void |
pending(java.lang.String step)
|
void |
successful(java.lang.String step)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PrintStreamScenarioReporter()
public PrintStreamScenarioReporter(java.io.PrintStream output)
public PrintStreamScenarioReporter(java.util.Properties outputPatterns)
public PrintStreamScenarioReporter(KeyWords keywords)
public PrintStreamScenarioReporter(java.io.PrintStream output,
java.util.Properties outputPatterns,
KeyWords keywords,
boolean reportErrors)
| Method Detail |
|---|
public void successful(java.lang.String step)
successful in interface ScenarioReporterpublic void pending(java.lang.String step)
pending in interface ScenarioReporterpublic void notPerformed(java.lang.String step)
notPerformed in interface ScenarioReporter
public void failed(java.lang.String step,
java.lang.Throwable cause)
failed in interface ScenarioReporterpublic void afterScenario()
afterScenario in interface ScenarioReporterpublic void beforeScenario(java.lang.String title)
beforeScenario in interface ScenarioReporterpublic void afterStory()
afterStory in interface ScenarioReporterpublic void beforeStory(Blurb blurb)
beforeStory in interface ScenarioReporterpublic void givenScenarios(java.util.List<java.lang.String> givenScenarios)
givenScenarios in interface ScenarioReporterpublic void examplesTable(ExamplesTable table)
examplesTable in interface ScenarioReporterpublic void examplesTableRow(java.util.Map<java.lang.String,java.lang.String> tableRow)
examplesTableRow in interface ScenarioReporter
protected java.lang.String format(java.lang.String key,
java.lang.String defaultPattern,
java.lang.Object... args)
key - the event keydefaultPattern - the default pattern to return if a custom pattern is not foundargs - the args used to format output
protected java.lang.String lookupPattern(java.lang.String key,
java.lang.String defaultPattern)
MessageFormat#format() method. If no pattern is found
for key or needs to be overridden, the default pattern should be
returned.
key - the format pattern keydefaultPattern - the default pattern if no pattern is
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||