开发者

Cucumber: "Given" step must test something

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜