我在IntelliJ中运行了Jbehave测试,将其打印到控制台,我注意到的一件事是每个故事步骤打印两次,例如:
2019-05-30 08:11:09 [pool-19-thread-1] INFO c.s.c.cassandra.CassandraRepository - Looking in the table member_by_account_id
Then poll MemberByAccountId table for view processor
Then poll MemberByAccountId table for view processor
And verify the MemberByAccountId payload in view table
And verify the MemberByAccountId payload in view table
Given modify ingestion payload to appear older
Given modify ingestion payload to appear older
2019-05-30 08:11:09 [pool-19-thread-1] DEBUG c.s.c.j.m.s.VerifyServiceSteps - published message [{"topic":"/subscriptions","subject":"Message","id":"xxxxx",...}"}}] published date 2019-04-30T15:11:09.584Z
When publish the payload to ingestion eventHub
When publish the payload to ingestion eventHub
2019-05-30 08:11:09 [pool-19-thread-1] DEBUG c.s.c.j.m.s.VerifyServiceSteps - looking for date 2019-04-30
2019-05-30 08:11:09 [pool-19-thread-1] INFO c.s.c.cassandra.CassandraRepository - Looking in the table ingest_audit
所有带有INFO / DEBUG的条目均来自org.slf4j.Logger的Java代码,其他条目均来自Jbehave的打印内容,您可以告诉每个步骤打印两次。除了主线程外,只有一个线程(pool-19-thread-1)。
这是故事运行程序的配置:
public AbstractJbehaveStoryRunner() {
List<String> filters =
Arrays.stream(System.getProperty("meta.filter", "").split(","))
.map(String::trim)
.collect(Collectors.toList());
LOGGER.debug("filters------" + filters);
embedder.useMetaFilters(filters);
embedder.useTimeoutParsers(timeout);
this.useEmbedder(embedder);
initJBehaveConfiguration();
}
protected String[] getStepConfigResources() {
return new String[0];
}
private void initJBehaveConfiguration() {
Class<?> thisClass = this.getClass();
ExamplesTableFactory examplesTableFactory =
new ExamplesTableFactory(new LoadFromClasspath(this.getClass()), new TableTransformers());
useConfiguration(
new MostUsefulConfiguration()
.useStoryLoader(new LoadFromClasspath(thisClass.getClassLoader()))
.usePendingStepStrategy(new FailingUponPendingStep())
.useStepdocReporter(new PrintStreamStepdocReporter())
.useStoryReporterBuilder(
new StoryReporterBuilder()
.withReporters(new ConsoleOutput())
.withFailureTrace(true)
.withCodeLocation(CodeLocations.codeLocationFromClass(thisClass))
.withDefaultFormats()
.withFormats(Format.CONSOLE, Format.TXT, Format.HTML, Format.XML, Format.STATS)
.withCrossReference(new CrossReference()))
.useParameterConverters(
new ParameterConverters()
.addConverters(
new ParameterConverters.DateConverter(new SimpleDateFormat("yyyy-MM-dd"))))
.useStoryParser(new RegexStoryParser(examplesTableFactory))
.useStepMonitor(new SilentStepMonitor()));
}
如何删除重复的步骤打印?