javaseleniumjbehave

Concurrent Story Reporters in Jbehave


I am developing my custom story reporter which extends NullStoryReporter. But my tests should be run in concurrent mode. For this case I found ConcurrentStoryReporter in org.jbehave.core.reporters package, but I have some difficulties in its usage.

ConcurrentStoryReporter' constructor:

public ConcurrentStoryReporter(StoryReporter crossReferencing, StoryReporter delegate, boolean multiThreading) {
    this.crossReferencing = crossReferencing;
    this.delegate = delegate;
    this.multiThreading = multiThreading;
    delayedMethods = multiThreading ? Collections.synchronizedList(new ArrayList<DelayedMethod>()) : null;
}

As I understand the delegate is my custom story reporter. But could you, please, clarify what should I cast as 'StoryReporter crossReferencing' to the constructor? Are there any example of usage the class?


Solution

  • crossReferencing could be new NullStoryReporter().

    In general it's not required to use ConcurrentStoryReporter explicitly. JBehave wraps reporters automatically when number of threads is more than 1.