JUnit

Junit is one of the popular testing framework which is used to test Java scenarios are functioning properly or not. Previous to write Junit test cases, we have to download and install JDK and setup JDK installation path into environment variables. Then download latest version of eclipse IDE and install. Now, follow below steps to create Java project and configure Junit into the project classpath.

To create Java project in eclipse: File ==> New ==> Others(this step can be skipped) ==> Java Project (Look at the below screenshots if you are not aware)
Enter project name, in this example I have given as Junit and click on Next button.
Choose Libraries tab and click on Add Library button to add Junit dependencies/library.
Select Junit from list of available libraries and click on Next button.
Select the required version of Junit from dropdown list and click on Finish button to add Junit dependency to Java project. In this case, I have selected the Junit 5 version.
The below screen will show you the list of Libraries applicable on your project which is also included JUnit in it. So, adding Junit library into Java project has been completed. Clikc on Finish button to create Java project.
Congratulations, You have successfully created Java project. Now, you are ready to write Java code and implement test cases for your Java logic. Happy Coding.... :)

Comments

Popular posts from this blog

Hibernate auto increment with example

how to count the page views by using JSP

Multithreading in java with example

How to retrieve data from table by using JDBC with example

Prime, Fibonacci and Factorial number with example in java

How to insert images into database using JDBC?

How to sort list of objects in java with examples

String interview questions and answers

Exception in thread "main" java.lang.NoClassDefFoundError: javax/transaction/SystemException

Store file into table by using JDBC with example