如何将元素的值存储在一个场景的 API 响应中,并在同一功能文件的其他场景中使用该变量?

How can is store the value of an element in a API response from one scenario and use the variable in the other scenarios in the same feature file?

考虑一下我的功能文件中有三个场景。我想要在第一个场景中从 API 响应中获得的授权令牌用于其他场景。

我在 "Background:" 部分声明了变量。如何跨场景使用变量?

Background: 中声明的任何变量都可用于同一功能的所有 Scenario:

参考这个答案了解更多: