Is it bad form to count on the order of your NUnit unit tests

后端 未结 8 1785
别跟我提以往
别跟我提以往 2021-02-13 06:16

I have been creating Unit tests like crazy and find that I\'m often having to set up something in one test that I just tore down in a previous test. Is it ever reasonable to cr

8条回答
  •  旧时难觅i
    2021-02-13 06:54

    Unfortunately run order of the unit test is not predictable or at least could be changed in future. E.g. unit testing framework will be changed so each test will be executed in separate thread. So from my point of view using test order is not reasonable. On the other hand you can create a set of small independent tests to test small parts of your code and then create one or several large tests that will run your small tests in specific order.

提交回复
热议问题