Passing JUnit data between tests

后端 未结 5 1227
鱼传尺愫
鱼传尺愫 2020-12-10 11:07

I just discovered when creating some CRUD tests that you can\'t set data in one test and have it read in another test (data is set back to its initialization between each te

5条回答
  •  长情又很酷
    2020-12-10 11:34

    JUnit promotes independent tests. One option would be to put the two logical tests into one @Test method.

    TestNG was partly created to allow these kinds of dependencies among tests. It enforces local declarations of test dependencies -- it runs tests in a valid order, and does not run tests that depend on a failed test. See http://testng.org/doc/documentation-main.html#dependent-methods for examples.

提交回复
热议问题