JUnit comes integrated with Eclipse, NetBeans and IntelliJ. You can write the JUnit tests manually, but these IDEs make it much easier. This video takes a quick look at each of these IDEs. We start with Eclipse by adding a new project. Next, we will walk through the steps to create a unit test using the JUnit framework.
- [Instructor] JUnit comes integrated with…the IDEs Eclipse, NetBeans, and IntelliJ.…You can write the JUnit Test manually,…but these IDEs make it much easier.…Let's take a quick look at each of the IDEs.…I'm gonna start with Eclipse, which I have open here.…First, I'll create a new Java project,…File, New, Java Project,…and I'm just gonna call it EclipseExample.…
I'm gonna expand this by clicking on the little icon there,…and then in the src folder, I'm gonna…add a new class that I wanna test, New, Class,…and this class I'm gonna call PrintGrade.…I'm gonna leave everything else as the default,…'cause I don't want to have public static void main,…I just wanna test this class.…I'm gonna click Finish.…In the PrintGrade class, I'm going to add a method that…takes in as a parameter a numeric grade.…
It will compare that grade and return a string that…gives a message saying what letter grade they got…based on their numeric grade.…So I'm gonna do public String,…because it's going to return a string,…and I'll just call it print,…
- What is JUnit?
- Comparing values with assertions
- Using JUnit with different Java IDEs
- Creating basic unit tests
- Testing for exception handling
- Creating parameterized tests