Unit Testing in Java

  1. Unit Testing.
  2. JUnit.
  3. TDD.

Unit Testing

JUnit

  • There is no main method. JUnit provides its own run engine.
  • We have separate test cases. The test case in JUnit is represented by a void method tagged with @Test annotation.
  • Most of the test cases will have input, actual results, expected results. Each test case should have assertions to validate the actual result with the expected result.

Test-driven development

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store