Cucumber 在黄瓜测试中,如何将从一个传感器获得的值传递给另一个传感器?
我希望能够使用来测试以下场景Cucumber 在黄瓜测试中,如何将从一个传感器获得的值传递给另一个传感器?,cucumber,cucumberjs,Cucumber,Cucumberjs,我希望能够使用来测试以下场景 Feature: test Scenario: Start a service When I start a service Then I obtain a token Scenario: Customers join a service When I have a token Then open a url and apply the token 底层实现是在typescript中 在第一个场景中,我将生成一个令牌。
Feature: test
Scenario: Start a service
When I start a service
Then I obtain a token
Scenario: Customers join a service
When I have a token
Then open a url and apply the token
底层实现是在typescript中
在第一个场景中,我将生成一个令牌。使用令牌,我想打开一个特定的url并在那里使用令牌
如何将令牌从一个场景传递到另一个场景?您不应该将值从一个场景传递到另一个场景。每个场景都应被视为一个独立的测试。尝试使用后台为每个场景设置新令牌
Background: Start a service
When I start a service
Then I obtain a token
Scenario: Customers join a service
When I have a token
Then open a url and apply the token
或者最好将启动服务
,获取令牌
和拥有令牌
推到单个中,然后从服务中获取令牌
Scenario: Customers join a service
Given the customers have obtained a token from a service
Then open a url and apply the token