JUnit is a unit testing framework for the Java programming language. It is used to write and run automated tests. JUnit is an open-source framework that is compatible with almost all IDEs. JUnit tests are typically written as classes that extend the JUnit TestCase class. Each test method is annotated with the @Test annotation. When a test method is executed, JUnit will assert that the expected result is equal to the actual result. If the assertion fails, JUnit will throw an exception. JUnit tests can be run from the command line or from within an IDE.
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.