Run PHPUnit Tests in Certain Order

前端 未结 8 1426
悲哀的现实
悲哀的现实 2020-12-04 15:20

Is there a way to get the tests inside of a TestCase to run in a certain order? For example, I want to separate the life cycle of an object from creation to use

8条回答
  •  甜味超标
    2020-12-04 15:47

    Maybe there is a design problem in your tests.

    Usually each test must not depend on any other tests, so they can run in any order.

    Each test needs to instantiate and destroy everything it needs to run, that would be the perfect approach, you should never share objects and states between tests.

    Can you be more specific about why you need the same object for N tests?

提交回复
热议问题