Should I change the naming convention for my unit tests?

后端 未结 7 2393
死守一世寂寞
死守一世寂寞 2021-02-20 04:45

I currently use a simple convention for my unit tests. If I have a class named \"EmployeeReader\", I create a test class named \"EmployeeReader.Tests. I then create all the test

7条回答
  •  没有蜡笔的小新
    2021-02-20 05:34

    Your second example (having a fixture for each logical "task", rather than one for each class) has the advantage that you can have different SetUp and TearDown logic for each task, thus simplifying your individual test methods and making them more readable.

    You don't need to settle on one or the other as a standard. We use a mixture of both, depending on how many different "tasks" we have to test for each class.

提交回复
热议问题