我正在尝试创建并运行一个简单的 JUnitStory 来运行一个 .story 文件。
我有这个:
class Scenario1 extends JUnitStory {
@Delegate MySteps steps = new MySteps()
@Override
public Configuration configuration() {
return new MostUsefulConfiguration()
.useStoryLoader(new LoadFromRelativeFile(new File('src/test/groovy').toURL()))
.useStoryReporterBuilder(
new StoryReporterBuilder()
.withDefaultFormats()
.withFormats(Format.HTML, Format.CONSOLE, Format.TXT)
);
}
@Override
public List candidateSteps() {
final candidateSteps = new InstanceStepsFactory(configuration(), this).createCandidateSteps()
return candidateSteps;
}
}
无论有没有委托(复制和粘贴 MySteps 的所有带注释的方法),每当我运行 JBehave 时,我都会得到以下输出:
somePattern(){
// PENDING
}
就像个别故事没有跟上步骤一样。
当我创建一个“故事”类并将所有故事文件拉入其中时storyPaths
,将定义各个步骤。使用调试器,我看到候选步骤被击中,但它没有提取所需的数据。
这里可能发生了什么?