LoginSignup
1
0

More than 5 years have passed since last update.

C#におけるユニットテストの名付けの基本的なルール

Posted at

プロジェクト名

[テストをするプロジェクト名].UnitTests

クラス名

[テストをするクラス名].Tests

テストメソッド名

[UnitOfWorkName]_[ScenarioUnderTest]_[ExpectedBahavior]

UnitOfWorkName・・・メソッド名、メソッドのグループ名(複数のメソッドにまたがるユースケース)やテストするクラス名 e.x. "UserLogin", "RemoveUser", "StartUp"

ScenarioUnderTest・・・どんな条件でテストされるか e.g. "bad login", "invalid user", "good password". パブリックメソッドに送られるパラメータやシステムの初期状態 e.g. "system out of memory", "no users exist", "user already exists"

ExpectedBahavior・・・戻り値や例外、結果としてのシステムの状態、、、

e.x. IsValidFileName_BadExtension_ReturnsFalse()

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0