Setting up JUnit

Course Home | Download and Install JUnit

As mentioned throughout the Basic Java course I use Maven when I develop in Java. We spoke about that in lesson 2. So getting JUnit into our project is a simple case of telling Maven we want to. From the link above you can find all the ways to install JUnit. However, in Maven, we had to add the dependency to our POM file.


This was directly copied from the link above on 24th August 2017. So be sure to check this is the latest version if following this material. There is a new value that we haven’t spoken about through all this material, that is <scope>. You can see here it’s set to test which means Maven won’t include that dependency for normal use builds, only for test compilation and execution builds. More on those to come.

JUnit will now be added to our project and we’ll be able to add it to the classes we need.

Next Lesson ➔

Richard Bradshaw's photo

Richard Bradshaw


Software Tester, speaker and trainer at Friendly Testing. BossBoss at Ministry of Testing. Whiteboard Testing creator. Striving to improve the testing craft.