タグ

junitに関するkoherentのブックマーク (2)

  • 3. テストクラス2 (2)

    JUnit 3章 テストクラス2 3.1. テストメソッドが処理される順序に注意しよう 3.2. 「副作用」があるテストは書かない 3.3. テストはソースコードと同じ場所に保管しよう 3.4. テストには、適切な名前を付けよう 3.5. JUnitのassert/failメソッドと例外処理を最大限に利用しよう 3.6. テストはjavadocで書面化しよう 3.7. テストはできるだけ小さく、できるだけ早く 3.5 JUnitのassert/failメソッドと例外処理を最大限に利用しよう JUnit見習が犯しやすい問題として、膨大なtry・catchブロックを使用して、例外を検知して、テストの成否を判定することです。例えば、以下のプログラムです。 public void exampleTest () { try { // do some test } catch (SomeApplica

  • JUnit 5 tutorial - Learn how to write unit tests

    Lars Vogel (c) 2007 - 2024 vogella GmbH version 4.6, 31.07.2021 This tutorial explains unit testing with JUnit with the JUnit 5 framework (JUnit Jupiter). It explains the creation of JUnit 5 tests with the Maven and Gradle build system. It demonstrates the usage of the Eclipse IDE for developing software tests with JUnit 5 but this tutorial is also valid for tools like Visual Code or IntelliJ.

  • 1