gpt4 book ai didi

cucumber - 在 Cucumber Gherkin 的同一场景中运行两个用户故事

转载 作者:行者123 更新时间:2023-12-04 08:27:33 25 4
gpt4 key购买 nike

我正在尝试创建一个场景,其中两个用户将访问该应用程序,因此当一个用户(或多或少)将其放在购物车上时,我可以模拟售罄的产品。
例如。Given user1 access websiteThen user1 add a product to the cartuser2 来了(不太确定我是否应该使用另一个 Given 或 And,这里的重点是打开另一个窗口,并保持 user1 的窗口处于保留状态)。Given user2 access websiteThen user2 add a product to the cartAnd user2 complete purchase (关闭user2的窗口)
在这里,用户 1 将尝试完成购买(返回用户 1 窗口)Then user1 tries to finalize the purchase and gets a warning that product is no longer available这与其说是实际流程,不如说是一个想法,但这里的要点是要产生这种空库存的“冲突”。我希望 user1 能够将产品添加到购物车,以便稍后显示该产品不再可用的警告。因此,我不能让场景以空库存开始,因为这样用户 1 甚至不会看到要对其进行测试的产品。

最佳答案

我建议使用以下线性方法。
我假设可以在不同选项卡的一个浏览器中记录 2 个用户

Given user1 access website
When user1 add a product to the cart
And I open 2nd chrome tab
And user2 access website on 2nd tab
And user2 add a product to the cart
And user2 complete purchase
And I close 2nd chrome tab
And I refresh session on 1st tab
Then user1 can not complete purchase and and see 'product no longer available' warn

关于cucumber - 在 Cucumber Gherkin 的同一场景中运行两个用户故事,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65190893/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com