Category: JUnit

JUnit 4.x – Testing Framework : Timeout Example 0

JUnit 4.x – Testing Framework : Timeout Example

Timeout Example Downloads Examples Timeout Example JUnit provides a handy option of Timeout. If a test case takes more time than specified number of milliseconds then Junit will automatically mark it as failed. The...

JUnit 4.x – Testing Framework : Parameterized Example 0

JUnit 4.x – Testing Framework : Parameterized Example

Parameterized Example Downloads Examples Parameterized Example JUnit 4 has introduced a new feature Parameterized tests. Parameterized tests allow developer to run the same test over and over again using different values. There are five...

JUnit 4.x – Testing Framework : Error Example 0

JUnit 4.x – Testing Framework : Error Example

Error Example Exception Example Downloads Examples Error Example Item.java package com.javaskool; public class Item { private int[] array; public Item(int size) { array= new int[size]; } public String getHelloWorld() { return “Hello World”; }...

JUnit 4.x – Testing Framework : Assertion Example 0

JUnit 4.x – Testing Framework : Assertion Example

Assertion Example Downloads Examples Assertion Example AssertionTest.java package com.javaskool; import static org.junit.Assert.*; import org.junit.After; import org.junit.Before; import org.junit.Test; public class AssertionTest { @Before public void setUp() throws Exception { } @After public void tearDown()...

JUnit 4.x – Testing Framework : Annotation Example 0

JUnit 4.x – Testing Framework : Annotation Example

Annotation Example Downloads Examples Annotation Example Employee.java package com.javaskool; public class Employee { private String name; private double monthlySalary; private int age; public String getName() { return name; } public void setName(String name) {...

JUnit 4.x – Testing Framework : JUnit Example 0

JUnit 4.x – Testing Framework : JUnit Example

JUnit First Example Downloads Examples JUnit First Example Calculator class that helps to add two number. Calculator.java package com.javaskool; public class Calculator { public int add(int a,int b) { return a+b; } } CalculatorMesg...

JUnit API Hierarchy 0

JUnit 4.x – Testing Framework : JUnit API

JUnit Framework API Downloads Examples JUnit Framework API we have to understand following in order to use JUnit for unit testing The class hierarchy of junit.framework Package What is a TestCase Class Working with...

JUnit Eclipse Plugin 0

JUnit 4.x – Testing Framework : JUnit Setup

JUnit Setup JUnit as Eclipse Plugin Download Examples JUnit Setup Downloading JUnit Click here to download Direct Download of JUnit Framework Download JUnit from Maven Central After download, you will get junit-4.12.jar. if extract...

TestNG Vs JUnit 0

JUnit 4.x – Testing Framework : Introduction to JUnit

JUnit Introduction Features of JUnit Design of JUnit TestNG Vs JUnit Understanding Unit Test Sample Code for JUnit JUnit Introduction What is JUnit JUnit supports Unit testing for Java Programming Language JUnit is an...