Selenium + JUnit: test order/flow?

前端 未结 5 798
感动是毒
感动是毒 2021-02-03 10:08

I am using Selenium to test my java web app\'s html pages (JSPs actually). My web app requires a flow to access each pages (it is a small online game web app), as in: to get to

5条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-03 10:42

    You can implement your own Runner that will probably wrap other Runner and sort tests according to criteria yo9u defined. This is if you really need this.

    But I do not think it is so necessary. I understand that if page A does not work the pass to B will not work too. So you want to run the test A first and then run test A->B. But does it really make sense? If for example test A->B runs first and fails because it cannot arrive to page A other test that verifies test A will fail too. So, Both tests will fail and id does not depend on the tests order.

    If however you mean that you want to use test A as a set up operation of test B it is very bad practice. You can use the logic of test A as a start of test B but you should not couple between 2 tests. One obvious reason is that this makes debugging very hard. To debug test A->B you have to run both A and A->B tests that means that you probably have to run all tests (at least within one test case).

提交回复
热议问题