Continue test case on assert

我只是一个虾纸丫 提交于 2020-04-13 17:17:27

问题


last time i am using testcafe i have realized about function which missing me in this great framework. This function is something like "continue executing the rest of particular test despite of fact that assertions appears"

To be more precise, I describe the reason i missing something like such function: Let say you are testing web application like web form where you are entering date for contracts. Such contract forms contains a lot of input boxes, dropdown menu, checkboxes etc.

First simple test will be something like this:

  • entering data all over form in every input, mark chekcboxes, selecting value from dropdown menu etc. This is only one test, for simple show case.

  • Then, you run it this test all over environments, and everything is working fine. Good.

In next webapp release you have to test if everything is working fine. But this test stopped on first assertion. And at this moment you dont know how many other assertions you have, because test script will stop working at this step.

All you can do is comment this line and start test case again. And, let say, next assertion appears on the next line.

You probably know what I mean by that. Is it possible to continue the test despite the error, and then write that test failed and display information about all errors/assertions?

From what i know and my experience, all i can do at this moment is put on every :except: condition something like :if - else:. But this is enormy work with rewriting existing test scripts.

I am sure not only me think about this. But, sadly, i am unable to found any information on web in connection with Testcafe, how you, guru's, solving this.

What do you think about this ?

thank and cheers


回答1:


TestCafe does not allow running next steps if a previous step fails. The reason of this is that in most scenarios, the next step depends on the previous step.

For example, a user wishes to click a button, which appears after he/she selects a radio button item. If the first step (selects the radio button item) fails, the button will not appear and the user will not be able to click an invisible element. So, running 2, 3, etc. steps does not make sense. You need to fix an issue at the first step to continue working with your page.

If your steps do not depend on each other, it is better to create a separate test for each independent scenario. In this case, you will be able to skip running failed tests and fix them when necessary. To skip tests, use the test.skip TestCafe method.    



来源:https://stackoverflow.com/questions/52206058/continue-test-case-on-assert

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!