[英]cucumber feature file to run in order
问题:我需要运行我的黄瓜.feature文件以我定义的顺序执行,而不是以默认顺序(即文件夹结构)运行。
我正在运行使用Cucumber .features文件构建的Android本机应用程序Appium。 在Windows计算机上,在实际设备上运行。
现在我的Runcuckes文件如下所示:
package runner;
import org.junit.runner.RunWith;
import org.testng.annotations.Test;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
import cucumber.api.testng.AbstractTestNGCucumberTests;
//@RunWith(Cucumber.class)
@CucumberOptions(features = { "src/test/java/features" },
glue = { "Steps" },
monochrome = true,
tags = { "@CustomerInsightsSurveyPopupGiveFeedback,"
+ "@TestAccountSceanrios"
+ "@ShortlistPage,"
+ "@SavedSearchesPage,"
+ "@SearchResultPage,"
+ "@Short,"
+ "@SuggestedSearch" })
// public class RunCucke {
public class RunCucke extends AbstractTestNGCucumberTests {
}
按顺序运行功能或方案很容易出错。
在所有测试中,将一个测试链接到另一个测试就是一种反模式。 它使您的测试易碎且难以调试。 每个测试应独立于其他测试。
在Cucumber中,您可以使用Givens设置方案的状态。 什么时候真正要做某事。 然后检查您的结果。 给定的方案给定的方案应包括设置应用程序所需的所有内容,以便您可以进行操作。
Cucumber鼓励您以随机顺序运行方案,并重置每个方案之间的几乎所有内容。 不要为此而努力,如果这样做,会使事情变得更加困难。
例如:如果这是您非常基本的功能文件...
Scenario: Verify View and Write Rewiev is visible Given I am on AbanteCart Home Page When I hover over the "SKIN CARE" option Then I click on the "SUN" option Then I should see the "Flash Bronzer Body Gel" When I hover over ont the Image Then I "View and Write Rewiev" option shoulde be visible
..您需要在PACKAGE EXPLORER中右键单击该功能文件,或者在文件内单击鼠标右键,然后选择“以CUCUMBER FEATURE运行”。
它将为您提供可以实施的缺少的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.