如何从黄瓜功能文件传递柏树环境变量?

发布于 2025-01-27 18:40:04 字数 116 浏览 3 评论 0原文

我想从Cucumber功能文件传递柏树环境变量。但是,在柏树中运行脚本时,找不到404的错误。

有什么想法吗? 使用的版本: “柏树”:“^9.5.4”, “赛普拉斯 - 核对象预处理”:“^4.3.1”

I want to pass cypress environment variables from cucumber feature file. But while running scripts in cypress runner getting 404 NOT FOUND error.

Any Ideas please?
Versions used:
"cypress": "^9.5.4",
"cypress-cucumber-preprocessor": "^4.3.1"

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

糖粟与秋泊 2025-02-03 18:40:04

下面,我向您展示如何在功能文件中使用任何变量。您只需通过环境变量替换示例中的变量(这是资产名称)。

Feature: Business critical scenarios

Verify the proper operation of most critial scearnios

Scenario Outline: Add a asset successfully
    Given I go to the Add Asset tab
    When Validate page title and url
    And I type the valid name <assetName> in the asset input box
    Then I press send button
    And Validate the asset <assetName> is added successfully

Examples:
  | assetName         |
  | "ABCD0000000026"  |

注释

  1. 在我的示例中,该部分示例中的变量和字段资产名称下方是引号,因为我的测试文件中的预期变量并与这些步骤链接在一起,这是一个字符串。如果您使用的是int,则必须跳过报价。

  2. 如果在ABCD0000000026以下添加更多值,则测试将与您添加的值一样多次运行,例如loop

Below, I show you how to use any variable within a feature file. You only have to replace the variable in the example (which is assetName) by your environment variable.

Feature: Business critical scenarios

Verify the proper operation of most critial scearnios

Scenario Outline: Add a asset successfully
    Given I go to the Add Asset tab
    When Validate page title and url
    And I type the valid name <assetName> in the asset input box
    Then I press send button
    And Validate the asset <assetName> is added successfully

Examples:
  | assetName         |
  | "ABCD0000000026"  |

Notes:

  1. In my example the variable within the section Examples and below the field assetName, it's in quotes because the expected variable in my test file and linked with those steps, it's a string. If you are using int you must skip the quotes.

  2. If you add more values below ABCD0000000026, your test will run as many times as values you add, like a loop

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文