当前位置: 首页 > 知识库问答 >
问题:

JVM Cucumber:在单步定义上运行多个测试用例

鲜于德泽
2023-03-14

我在 jvm cucmber 中有一个场景,如下所示

Given I have launched the <app_name> application page
And I fill out the <first_name> and <last_name> on the page
And I click Submit
And I am shown <message> on the <app_name> page based on <decision>
When I fill in username with value <username>
And I fill in password with value <password>
And I fill in confirmPassword with value <confirmPassword>
Then I should see the enroll button enabled for submission

在上面的例子中,我只想提交一次申请,因为这非常耗时。一旦我只提交,我就可以获得注册页面,因为它受到会话令牌的限制。但在那之后,我想用不同的用户名、密码和确认密码集运行多个测试。在我们越过特定的提交步骤定义之后,是否可以进行多个测试运行。就像一个测试循环。

共有1个答案

王辉
2023-03-14

使用多个测试值运行相同功能的示例。

Feature: Some test feature

    Background:
    Given I have launched the <app_name> application page
    And I fill out the <first_name> and <last_name> on the page
    And I click Submit
    And I am shown <message> on the <app_name> page based on <decision>


    Scenario Outline:
    When I fill in username with value "<username>"
    And I fill in password with value "<password>"
    And I fill in confirmPassword with value "<confirmPassword>"
    Then I should see the enroll button enabled for submission

    Examples:
    |username|password|confirmPassword|
    |usernam1|password1|password1|
    |usernam2|password2|password2|
    |usernam3|password3|password3|

来源:软件自动机

 类似资料:
  • 我正在使用GEB/Spock进行自动化测试。我正在使用Gradle作为我的构建工具。 我想调用不同的gradle任务来构建和运行一个特定的规范(测试)或一套规范。 显然,已经有了现有的构建指令,因为我可以调用,而且所有的规范都在Chrome上运行,我只是不知道如何添加更多的任务

  • 我正在使用Spock框架进行测试(1.0-groovy-2.4版本)。Junit提供了使用命令行(使用Maven)运行特定测试的选项: 问题:我怎样才能和斯波克做到这一点? 这个版本依赖于Junit 4.12,Junit文档中指出,只有Junit 4才支持此功能。x、 基本上,斯波克应该提出类似的建议。

  • 我有一个Spring Boot项目,其中定义了几个apiendpoint。我目前正在为每个API编写集成测试。我的测试类注释如下。 现在,对于我的每个测试类,都会设置一个新的上下文来执行它们,这需要时间。我更喜欢将每个apiendpoint的测试用例保存在单独的类中,以便在逻辑上组织它们,但我不希望每次添加新的控制器类和相应的测试类时,我的测试执行时间都会猛增。我在这里做错了什么?

  • 我正在尝试创建一个Junit测试用例,用于测试批处理作业的单个步骤,而批处理作业又有一个自定义的,并将数据写入平面文件。我无法模拟可以注入处理器以写入平面文件的数据。请帮忙。 我按照以下链接中的步骤创建了一个测试用例来启动一个单独的步骤: https://docs.spring.io/spring-batch/trunk/reference/html/testing.html 由于我的reader

  • 我正在探索硒网格,用于在多个浏览器上执行测试。我已经按照在线教程配置了集线器和节点。我已经创建了一个测试脚本。 这是测试脚本的代码: 我的目标是在多个浏览器上运行此测试,我已经添加了所需的功能,如火狐, 感谢任何帮助

  • 我正在VSTS中使用“基于云的ApacheJMeter负载测试”任务执行JMeter脚本。我有一个响应断言作为JMeter测试的一部分。我能够通过VSTS中的发布定义触发测试。当断言失败时,我希望发布失败。目前,发布成功,并发出如下警告: 2018-02-21T18:23:31.1885342Z##[警告][异常] 1次出现['测试'、'HTTP请求'、'网络异常']:请下载测试日志以查看此url

  • 以下是我的行动: 我可以右键单击一个测试文件并选择test file,但当它运行时,它找不到该类。我在以下方面看到了错误: Ftharness是我的项目的顶级目录,而src/TestNG是下面包含TestNG测试的目录。我尝试过各种改变都没有成功。有人能帮忙吗?