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

后端 未结 8 1757
别跟我提以往
别跟我提以往 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条回答
  •  天涯浪人
    2021-02-13 06:58

    Look into test fixture setups that allow you to specify functions that will be executed before any of the tests in the fixture. This allows you to do common setup once and it will always run, whether you run one test, or all tests in the suite.

提交回复
热议问题