我是自动化的新手,并试图使用Selenium和jbehave自动化一些UI测试用例。基本测试似乎效果很好。现在,我有一个具有2个方案的故事文件,每个方案都在多个文件中定义了步骤。当我运行此测试案例时,它显示了。
测试被忽略。测试被忽略。测试被忽略。测试被忽略。测试忽略。[pool-1-thread-1]信息net.serenitybdd.core.core.serenity-测试未决
我在这里看到了一个类似的问题,但没有答案。谁能帮我吗?
Serenity-BDD:版本1.1.36
更新:我的文件夹结构就像测试 Java/... 帐户 脚步 应答 Usersteps 测试 帐户stest 帐户测试 Usertest 资源/... 帐户 测试 counders_test.story user_test.story
这是我与JunitStory的测试阶层。这查看了"步骤文件"帐户并正确执行的步骤。
@RunWith(JUnitReportingRunner.class)
public class AccountsTest extends JUnitStory {
private WebDriver driver = new FirefoxDriver();
@Override
public Configuration configuration() {
return new MostUsefulConfiguration()
.useStoryLoader(new LoadFromClasspath(this.getClass()))
.useStoryReporterBuilder(new StoryReporterBuilder()
.withReporters(new MyStoryReporter())
.withDefaultFormats().withFormats(StoryReporterBuilder.Format.CONSOLE, StoryReporterBuilder.Format.HTML, StoryReporterBuilder.Format.STATS));
}
@Override
public InjectableStepsFactory stepsFactory() {
return new InstanceStepsFactory(configuration(), new AccountsSteps(driver));
}
}
我尝试在下面添加类似Serenitystories的类
@RunWith(JUnitReportingRunner.class)
public class AccountTest extends SerenityStories {
public AccountTest() {
findStoriesIn("**//accounts/test");
}
}
控制台显示该文件夹中的所有故事/场景,但显示了所有忽略的测试。
检查单词"待处理"的构建日志/控制台输出。您可能有尚未实施的步骤。
如果是这种情况
You can implement missing steps with the snippets below:
@Given("^I am landing page$") public void i_am_landing_page() throws Throwable {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}
您必须将stepdefinition路由表示为
下面的代码import cucumber.api.CucumberOptions;
import cucumber.api.SnippetType;
import net.serenitybdd.cucumber.CucumberWithSerenity;
import org.junit.runner.RunWith;
@RunWith(CucumberWithSerenity.class)
@CucumberOptions(
plugin = {"pretty"},
features = "src/test/resources/features",
glue = "stepdefinitions",
snippets= SnippetType.CAMELCASE )
public class CucumberTestSuite {
}