Writing standards for unit testing

前端 未结 10 1181
自闭症患者
自闭症患者 2021-01-31 12:05

I plan to introduce a set of standards for writing unit tests into my team. But what to include?

These two posts (Unit test naming best practices and Best practices for

10条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-31 12:46

    I've found that most testing conventions can be enforced through the use of a standard base class for all your tests. Forcing the tester to override methods so that they all have the same name.

    I also advocate the Arrange-Act-Assert (AAA) style of testing as you can then generate fairly useful documentation from your tests. It also forces you to consider what behaviour you are expecting due to the naming style.

提交回复
热议问题