运行黄瓜场景时,我想在隐身模式下使用 Chrome。我尝试了通过互联网找到的一些建议,但似乎都不起作用。
目前,我想到了以下内容,它启动了 chrome,但不是在隐身模式下
Capybara.register_driver :selenium do |app|
caps = Selenium::WebDriver::Remote::Capabilities.chrome("chromeOptions" => {"args" => %w["--incognito"]})
Capybara::Selenium::Driver.new(app, {:browser => :chrome, :desired_capabilities => caps})
end
Run Code Online (Sandbox Code Playgroud)
有小费吗?
我使用此配置运行 maven-cucumber-reporting 插件,结果报告页面上的内部版本号始终等于 1。
<plugin>
<groupId>net.masterthought</groupId>
<artifactId>maven-cucumber-reporting</artifactId>
<version>0.0.6</version>
<executions>
<execution>
<id>execution</id>
<phase>verify</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<projectName>${project.name}</projectName>
<outputDirectory>${project.build.directory}/cucumber-html-reports</outputDirectory>
<cucumberOutput>${project.build.directory}/cucumber.json</cucumberOutput>
<enableFlashCharts>false</enableFlashCharts>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
如何传递内部版本号,例如从 Maven?
嗨,我需要使用cucumberJS 和webdriverIO 自动化一个网站。为此,我需要上传一个文件,但该字段是隐藏的。例如 :
<input type="file" id='uploadFile' style="display: none"'>
Run Code Online (Sandbox Code Playgroud)
但 webdriver 无法识别 UI 上的元素。
提前致谢...
我正在像这样比较 ruby+cucumber 中的两个 json 内容或对象,但是当我比较时,它不会忽略内容的顺序(如果内容发生变化)。我知道这个语句比较为两个字符串。那么无论如何我可以通过忽略其顺序来比较两个json对象?
expect(@act_resp_excl_key).to eq(exp_data_excl_key)
Run Code Online (Sandbox Code Playgroud)
使用上述详细信息添加更多信息。我有两个 json 文档,如下所示。
json1 = {
"entries" = > [{
"doingBusinessAsName" = > "KROGER FOODS",
"legalName" = > "Kroger-Corps"
}
]
}
json2 = {
"entries" = > [{
"legalName" = > "Kroger-Corps"
"doingBusinessAsName" = > "KROGER FOODS",
}
]
}
Run Code Online (Sandbox Code Playgroud)
当我在 ruby+cucumber 中比较这两个 json 时,我得到的结果是失败。但逻辑上它是一样的,我应该通过。我使用上面的比较语句来验证两个json。
@tgf,我使用了您指定的语句,但我的比较仍然失败。你能帮我看看是什么问题吗?
expect(JSON.parse(@act_resp_excl_key)).to eq JSON.parse(exp_data_excl_key)
Run Code Online (Sandbox Code Playgroud) package cucumber;
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(
format={"pretty"},
features= "src/features/"
)
public class cucumberRunner {
}
Run Code Online (Sandbox Code Playgroud)
使用:
错误跟踪:
java.lang.NoClassDefFoundError: org/dom4j/Element at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Unknown Source) at java.lang.Class.privateGetPublicMethods(Unknown Source) at java。 lang.Class.getMethods(Unknown Source) atcucumber.runtime.java.MethodScanner.scan(MethodScanner.java:40) 在cucumber.runtime.java.JavaBackend.loadGlue(JavaBackend.java:86) 在cucumber.runtime.Runtime。 (Runtime.java:91) 在cucumber.runtime.Runtime.(Runtime.java:69) 在cucumber.runtime.Runtime.(Runtime.java:65) 在cucumber.api.junit.Cucumber.createRuntime(Cucumber.java: 78)在cucumber.api.junit.Cucumber.(Cucumber.java:58) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect。NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java: 104) 在 org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86) 在 org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) 在 org.junit.internal.builders.AllDefaultPossibilitiesBuilder .runnerForClass(AllDefaultPossibilitiesBuilder.java:26) at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:59) at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:33) at org. …
@Before
public void quit_if_tagged_scenario_failed(Scenario scenario) {
if (!isTagged(scenario) && prevScenarioFailed)
throw new IllegalStateException("An important scenario has failed! Cucumber wants to quit.");
}
Run Code Online (Sandbox Code Playgroud)
我正在使用这种方法来检查之前的场景是否失败。如果失败,我想跳过该功能文件中的所有场景。所以这里的问题是,如果我正在运行两个功能文件,则功能文件中的最后一个场景失败,下一个功能的第一步也将失败,因为黄瓜上一个场景来自过去的功能文件失败。你知道如何处理这种情况吗?对你的帮助表示感谢。
我正在使用 Cucumber 1.2.2 jar 并收到以下代码的错误“类无法解析为类型”。有人可以提出解决方案。
从这个参考:
Java提供了几种标量类型。这些包括原始数字类型,以及布尔值和char。
每个标量(原始)类型都有一个关联的包装器类或引用类型。
阅读javadocs:
/**
* Converts the table to a List.
*
* If {@code itemType} is a scalar type the table is flattened.
*
* Otherwise, the top row is used to name the fields/properties and the remaining
* rows are turned into list items.
*
* @param itemType the type of the list items
* @param <T> the type of the list items
* @return a List of objects
*/
public <T> List<T> …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 Gatling 重用我现有的集成测试黄瓜小黄瓜场景进行性能测试。集成测试是用 restassured.io 和 Cucumber JVM 编写的。我想要做的是向现有的集成测试添加一个新标签,比如@Performance_REQ_noOfRequest_RESP_responseTime。
所以我想知道有没有办法以编程方式读取黄瓜标签,以便我可以提取请求和响应值并将其发送到 Gatling 测试。
示例 Gherkin is Feature:获取员工信息的端点
@Regression @Performance_Req_1000_Resp_100s
场景:获取员工
当我向 /api/employees 发送请求
然后我应该看到员工列表
我试图找出如何在我的步骤定义中从黄瓜功能文件中解析日期字段。
class Person{
String name
LocalDate dob
}
scenario: do something with people
Given list of people:
|name|dob|
| john| 20-09-2001|
@Given("^list of people:")
public void doSomething(List<Person> people) {
}
Run Code Online (Sandbox Code Playgroud)
请注意,我无权访问Person类,我确定自己必须编写自己的转换器或注册某个库中某人编写的转换器,在搜索到的唯一选项后,我看到的是使用@Transform更改它们pojo在java.time.LocalDate字段上。
我目前收到以下异常
cucumber.runtime.CucumberException: cucumber.deps.com.thoughtworks.xstream.converters.ConversionException: Cannot deserialize object with new readObject()/writeObject() methods
---- Debugging information ----
class : java.time.LocalDate
required-type : java.time.LocalDate
converter-type : cucumber.deps.com.thoughtworks.xstream.converters.reflection.SerializableConverter
path : /list/com.pkg.Person/dob
Run Code Online (Sandbox Code Playgroud)
我尝试将dateformat更改为yyyy-MM-dd,通常可以,但在这种情况下不行。我将不胜感激关于如何设置和注册自定义转换器的任何指示
我的黄瓜依赖项如下,如果有任何区别,我可以将其替换为较新版本。
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>2.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-spring</artifactId>
<version>2.4.0</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)