JBehave テスト作業の一部としてランナー クラスを取得しましたが、何らかの理由で Eclipse は "Run As..." で JUnit を許可しません。「mvn -Dtest=LoginTrial test」を使用して Maven から手動で開始しようとしましたが、テストも認識されませんでした。これがそのコードであり、どんなアイデアでも大歓迎です。
package tests.acceptanceTests.featureTests.login;
import java.text.SimpleDateFormat;
import java.util.List;
import org.jbehave.core.InjectableEmbedder;
import org.jbehave.core.annotations.Configure;
import org.jbehave.core.annotations.UsingEmbedder;
import org.jbehave.core.annotations.UsingSteps;
import org.jbehave.core.embedder.Embedder;
import org.jbehave.core.embedder.StoryControls;
import org.jbehave.core.io.CodeLocations;
import org.jbehave.core.io.LoadFromClasspath;
import org.jbehave.core.io.StoryFinder;
import org.jbehave.core.junit.AnnotatedEmbedderRunner;
import org.jbehave.core.parsers.RegexPrefixCapturingPatternParser;
import org.jbehave.core.reporters.StoryReporterBuilder;
import org.jbehave.core.steps.ParameterConverters.DateConverter;
import org.junit.Test;
import org.junit.runner.RunWith;
import steps.login.LoginSteps;
import tests.acceptanceTests.featureTests.login.LoginTrial.MyDateConverter;
import tests.acceptanceTests.featureTests.login.LoginTrial.MyReportBuilder;
import tests.acceptanceTests.featureTests.login.LoginTrial.MyStoryControls;
import tests.acceptanceTests.featureTests.login.LoginTrial.MyStoryLoader;
@RunWith(AnnotatedEmbedderRunner.class)
@Configure(storyControls = MyStoryControls.class, storyLoader = MyStoryLoader.class, storyReporterBuilder = MyReportBuilder.class, parameterConverters = { MyDateConverter.class })
@UsingEmbedder(embedder = Embedder.class, generateViewAfterStories = true, ignoreFailureInStories = true, ignoreFailureInView = true, verboseFailures = true,
storyTimeoutInSecs = 100, threads = 2, metaFilters = "-skip")
@UsingSteps(instances = { LoginSteps.class })
public abstract class LoginTrial extends InjectableEmbedder
{
@Test
public void run()
{
List<String> storyPaths = new StoryFinder().findPaths(CodeLocations.codeLocationFromClass(this.getClass()),
"../../../../../stories/login_trial.story", "");
injectedEmbedder().runStoriesAsPaths(storyPaths);
}
public static class MyStoryControls extends StoryControls {
public MyStoryControls() {
doDryRun(false);
doSkipScenariosAfterFailure(false);
}
}
public static class MyStoryLoader extends LoadFromClasspath {
public MyStoryLoader() {
super(LoginTrial.class.getClassLoader());
}
}
public static class MyReportBuilder extends StoryReporterBuilder {
public MyReportBuilder() {
this.withFormats(org.jbehave.core.reporters.Format.HTML, org.jbehave.core.reporters.Format.TXT, org.jbehave.core.reporters.Format.XML).withDefaultFormats();
}
}
public static class MyRegexPrefixCapturingPatternParser extends RegexPrefixCapturingPatternParser {
public MyRegexPrefixCapturingPatternParser() {
super("%");
}
}
public static class MyDateConverter extends DateConverter {
public MyDateConverter() {
super(new SimpleDateFormat("yyyy-MM-dd"));
}
}
}