Junit

JUNIT Projects

JUNIT Project 1

JUNIT Examples

JUNIT EXAMPLE

Creating a First test of Java
Previous Home Next

Step 1: you want to test the Java program then you create the Package and the package name is de.vogella.junit. and write the Java class

package de.vogella.junit.first;
public class MyFirstClass 
{
public int multiply(int x, int y) {
return x / y;
}
}

step 2: After you created a java program ,you can select a new class, and the new class is the Java Junit class. The Junit class is create a another new class to test the Java Program.

step 3: If you using new class for JUnit test case then create a new class name is MyFirstClassTest.Java class is created, and you test the operation from Java Program. Mainly two classes import . These class is a import org.junit.Test; and import static org.junit.Assert.assertEquals;

step 4: when you want to Test your Program then Follow the instruction of and go to next button.Open a new dialogue box in your MyEclipse. And Test which method you want to test.

Step 5: If you have not yet JUnit in your classpath, Eclipse will asked you if it should be added to the classpath.

Previous Home Next