Integration with Eclipse.
Note that JUnit 5 requires at least JDK 8 so it's a good idea to have at least JDK 8 to work with both JUnit 4 and 5 .
Download eclipse from :
https://www.eclipse.org/downloads/packages/
We can download the "Eclipse IDE for Java Developers" or if we want to develop J2EE applications also we can download "Eclipse IDE for Enterprise Java Developers" .
JUnit4
There are 2 different ways of getting our Java project to work with JUnit4. .
1) Include the jars ( junit and hamcrest ) as external jars to a Java project.
Rightclikck project/ properties
BuildPath/Libraries/Add External Jars
2)
Rightclikck project/ New JUnit Test Case
We can choose JUnit 4 or Junit 5 .
3) Eclipse can work with Maven projects
Right Click / New/Other/Maven Project.
Add the following to your pom.xml file:
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
Add the "MySimpleTest.java" to the src/test/java folder.
Run as "Maven Test"
Integration with Ant
Download Apache Ant 1.9.15 from
https://ant.apache.org/bindownload.cgi
You can unzip to anyplace.
Ex:
C:\apache-ant-1.9.15
Make sure your path is set to include the bin folder from the ant folder.
Windows Ex:
set path=c:\jdk18\bin;C:\apache-ant-1.9.15\bin;%path%
Create a folder say "ant-test" under JUnit.
Integration with Gradle
Download 6.7 from
https://gradle.org/install/