How many unit tests should I write per function/method?

后端 未结 12 2105
忘了有多久
忘了有多久 2020-12-05 18:36

Do you write one test per function/method, with multiple checks in the test, or a test for each check?

12条回答
  •  再見小時候
    2020-12-05 18:50

    I like to have a test per check in a method and have a meaningfull name for the test-method. For instance:

    testAddUser_shouldThrowIllegalArgumentExceptionWhenUserIsNull

提交回复
热议问题