JUnit 4 Installation and Setup

Installing and testing out JUnit is quite easy and quick to do.   We will take through this in an easy step by step manner.

1. Required Files

JUnit requires two jars files be downloaded from either JUnit.org or to make things easier I have downloaded and made the two jars available in one click.

  • junit.jar
  • hamcrest-core.jar

1.1 Download JUnit Jar File

2. Setting Up JUnit on Eclipse IDE

Now using our Package Explorer in let’s go ahead and right click and choose New Project.   For the name I chose FirstJUnitProject in the Project name field and click on the Finish button at the bottom of the dialog box.

junit_project

Now we can go ahead create a new library which will include the two jars files we downloaded earlier.  You will need to go to the package explorer and hover you mouse over the project called “FirstJunitProject” and do the following steps.

  1. Right click
  2. Choose Build Path
  3. Choose Configure Build Path
  4. Choose Add Library
  5. Choose User Library
  6. Click button on right button called User Libraries
  7. Click on New
  8. Give your new library name of JUnit

junit_library

Other Related Posts

Please Share Us on Social Media

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Leave a Reply

Your email address will not be published. Required fields are marked *