标签: cucumber

BDD 和表单字段

我读过示例规范和几篇 BDD 文章,它们都说要避免功能描述和场景中的特定表单字段之类的细节。但是,如果示例中没有说明我们需要哪些表单字段以及哪些验证是合适的,那么它在哪里呢?

我正在考虑将所有表单字段放入场景中,并为每个验证设置一个场景。看起来开销很大;有没有更好的办法?

编辑:例如,采用以下内容。

Feature: Add new product

In order to sell a new product on our website
As an internal user
I want to add the product to our catalog

Scenario: Successful addition

Given I am logged in
When I try to add a new product
And I provide "Widget" as the name
And I provide 1 lb. as the weight
And I provide 1 inch as the height
And I provide 2 inches as the width
And …
Run Code Online (Sandbox Code Playgroud)

bdd requirements cucumber

1
推荐指数
1
解决办法
2061
查看次数

使用 Capybara 模拟在文本框中输入内容

我使用 Cucumber 与 ruby​​ 和 capybara API 进行一些自动化测试。有一种情况,我需要模拟在其中一个文本框中输入内容以验证实时更改的值。我之前使用过“set(value)”。 “fill_in”对我不起作用,因为水豚无法找到我的文本框的 ID/名称。是否有任何方法可以模拟键入,然后将值设置为文本框,而不是设置值,因为这里的要求是验证实时更改。

提前致谢。

ruby automated-tests cucumber capybara

1
推荐指数
1
解决办法
1432
查看次数

屏幕上可见的所有字段是否都应该在 Gherkin 中进行验证?

我们正在为我们的应用程序创建 Gherkin 功能文件,以创建可执行规范。目前我们的文件如下所示:

Given product <type> is found
    When the product is clicked
    Then detailed information on the product appears
    And the field text has a value
    And the field price has a value
    And the field buy is available
Run Code Online (Sandbox Code Playgroud)

and我们想知道验证字段在屏幕上是否可见的整个关键字列表是否是正确的方法,或者我们是否应该将其缩短为“验证输入”之类的内容。

bdd cucumber specflow gherkin

1
推荐指数
1
解决办法
1624
查看次数

一个文件中 Cucumber 测试场景的最大/最佳数量

我有一个包含超过 66 个场景的 Cucumber 功能文件!功能文件的标题确实代表了场景的全部内容。

但 66(200 步)感觉是一个相当大的数字。这是否表明我的专题标题过于宽泛?

单个功能文件中的最大场景数是多少(从最佳实践的角度来看)?

提前致谢 :)

tdd bdd acceptance-testing cucumber cucumber-java

1
推荐指数
1
解决办法
6634
查看次数

ruby+Cucumber2.0中如何添加wait方法来等待特定元素加载

我在浏览器堆栈上测试我的案例时遇到问题。我面临的问题重现不一致。

为了让我的代码等待元素加载,我使用如下:

gift_no_btn1 = Capybara.find('giftingNoButton')
gift_no_btn1.click
Run Code Online (Sandbox Code Playgroud)

这里的问题是屏幕卡在另一个模块中,我的预期元素未加载,因此我的脚本失败。我读到在 Capybara 2.0 中 find() 方法被替换为 wait_untill 方法。

ruby rspec cucumber capybara

1
推荐指数
1
解决办法
6125
查看次数

配置 @RunWith 以在 IntelliJ 运行器中使用 CucumberWithSerenity.class 而不是 Cucumber.class

我有一个 gradle + Serenity + RestAssured 自动检查套件设置,我通常通过 shell 会话中的 gradle 命令运行,但有时我需要使用 IntelliJ 运行单个场景。

当我在 IntelliJ 上运行 Scenarios 时,我通常会收到很多这样的警告:

8312 [main] WARN cucumber.runtime.SerenityBackend - It looks like you are 
running a feature using @RunWith(Cucumber.class) 
instead of @RunWith(CucumberWithSerenity.class). 
Are you sure this is what you meant to do?
Run Code Online (Sandbox Code Playgroud)

我想知道在何处以及如何在 IntelliJ 中配置运行/调试配置,以便运行检查并CucumberWithSerenity.class修复警告。

我正在使用以下依赖项:

serenity-rest-assured:1.9.31
serenity-core:1.9.31
serenity-cucumber:1.9.12
Run Code Online (Sandbox Code Playgroud)

IntelliJ版本2018.1.5(社区版)

java intellij-idea cucumber serenity-bdd cucumber-serenity

1
推荐指数
1
解决办法
7300
查看次数

无法解析 Cucumber 报告中的方法“格式”

在此处输入图片说明 试图运行一个向 JSON 文件报告的黄瓜场景,但由于某种原因,“格式”不起作用。它指出'无法解析方法'格式'。我正在学习教程,但不明白为什么这不起作用。任何帮助将不胜感激,谢谢

使用 selenium/java/intelliJ/testNG

selenium cucumber

1
推荐指数
1
解决办法
1088
查看次数

钩子未在 Cucumber 4 中运行

运行 Runner 类时,钩子的 @Before 和 @After 方法没有运行。

我正在使用依赖项:黄瓜-java 4.3.0 黄瓜-jvm 4.3.0

除了钩子之外,stepdef 文件中的所有步骤都运行良好。最新的黄瓜版本有问题吗?

public class Hooks {
@Before
public void beforeHooks() {
    System.out.println("Run Before Scenario");
}

@After
public void afterHooks() {
    System.out.println("Run After Scenario");
}
Run Code Online (Sandbox Code Playgroud)

java cucumber

1
推荐指数
1
解决办法
3492
查看次数

Cucumber Test 步骤未在 J-Unit 中显示,而在控制台步骤已成功运行

我目前正在尝试创建我的第一个 Cucumber 测试。在 Java Eclipse 中,我创建了一个包含以下内容的“功能文件”:

Feature: Login functionality DemoQA.com

Scenario: Verify if user is able to login to the DemoQA website
    Given A user is on DemoQA.com
    When User clicks MyAccount link
    Then User is taken to Login Page
    When User enters valid username and password
    Then User is able to login 
Run Code Online (Sandbox Code Playgroud)

我还创建了以下 testrunner 文件:

@RunWith(Cucumber.class)
@CucumberOptions(   
        features = "src/test/Features/",
        glue = {"Tests"}
        )
public class CucumberRunner {
}
Run Code Online (Sandbox Code Playgroud)

我还创建了我的 Stepdefinitions:

公共类 LoginStepDefinitions {

@Given("A user is on DemoQA.com") …
Run Code Online (Sandbox Code Playgroud)

java junit cucumber

1
推荐指数
1
解决办法
2566
查看次数

Cucumber 标签:类型不匹配:无法从 String[] 转换为 String

在 下@CucumberOptions,同时使用标签选项仅执行一些测试集,例如:烟雾测试。我已经编写了如下所述的标签代码:

@CucumberOptions(
        tags = {"@SmokeTest"} // <<< Type mismatch: cannot convert from String[] to String
        )
Run Code Online (Sandbox Code Playgroud)

但我收到类型不匹配错误。

cucumber

1
推荐指数
1
解决办法
2034
查看次数