开发者

Cucumber: "Given" step must test something

开发者 https://www.devze.com 2023-02-11 09:52 出处:网络
I\'m reworking my tests into Cucumber, but I must still use some user-provided information (namely, an account that the tests should be run against):

I'm reworking my tests into Cucumber, but I must still use some user-provided information (namely, an account that the tests should be run against):

Given a valid account
开发者_如何学PythonWhen I ...
Then I ...

Because of this, I must check the validity of the provided account during the "Given" step, and fail the scenario if it's invalid. What would be the correct way of doing so?


The usual way I've seen of going about this is to run in a temporary environment where you can mock a valid user. So in your Given step you should create a new, valid user. Then run the rest of your test and remove the user after the test exits.

0

精彩评论

暂无评论...
验证码 换一张
取 消