我知道的方法是这个
Given(
`Step1`,
async function() {
const IwantToUseThisObj = {
A: 'a',
B: 'b'
}
this.IwantToUseThisObj = IwantToUseThisObj
}
)
Then(`Step2`, async function() {
IwantToUseThisObj = this.IwantToUseThisObj
})
但是我不确定这是否是最佳实践,如果我需要大量使用它,它看起来非常重复,
还有更好的方法吗?我只想使用在给定步骤中使用的值
是的,将数据存储在世界一流的位置上以进行重用是黄瓜的最佳做法