markdown 单元测试命名约定

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 单元测试命名约定相关的知识,希望对你有一定的参考价值。

**Should_ExpectedBehavior_When_StateUnderTest:**  
This technique is also used by many as it makes it easy to read the tests. Following is how tests in first example would read like if named using this technique:  
* Should_ThrowException_When_AgeLessThan18  
* Should_FailToWithdrawMoney_ForInvalidAccount  
* Should_FailToAdmit_IfMandatoryFieldsAreMissing

From <https://dzone.com/articles/7-popular-unit-test-naming> 

**[method]_Should[expected]_When[condition]    
Deposit_ShouldIncreaseBalance_WhenGivenPositiveValue()

From <https://stackoverflow.com/questions/155436/unit-test-naming-best-practices?rq=1>

以上是关于markdown 单元测试命名约定的主要内容,如果未能解决你的问题,请参考以下文章

单元测试都有哪些流行的命名约定? [关闭]

markdown 数据库命名约定

markdown 命名约定

markdown PHP命名约定

markdown 遵循Laravel命名约定

markdown Git Branch命名约定