Basic Annotations of Junit

Before learning the Junit framework. Let’s have a look at why we need to use this Junit, by understanding the usage of Unit Testing Framework.

Understanding of Unit Testing Framework :

What is Unit Testing?
Unit Testing is defined as testing individual units or modules without integrating with other units. Mostly this testing is done by the Developers.

Why do Developers do Unit Testing?

Developers do unit testing to ensure everything is working fine as expected before pushing or deploying the code from developers environment to QA environment.

What is Junit?
JUnit is one of the unit testing frameworks for Java programming Language. JUnit is used for

1.Writing individual Unit Tests.

2.Write multiple unit tests under the Test Suite.

3.Generating the Test Results.

How to install Junit in Eclipse?

Step 1 : Downloading the jars of Junit and Apart from Junit jar file we need to download the hamcrest-core.jar from the below URL

Download JUnit and Install

Step 2 : Creating project in eclipse and adding jar files to the project

JUnit : JUnit is one of the most famous Unit Testing Framework for Java. This JUnit frameworks are used by Developer to Complete their unit testing before moving the build from Development environment to QA environment.

Basic Annotations used in Junit :
1.@BeforeClass – Is used to run only once before executing the test methods in the class.

2.@AfterClass – Is used to run after all the available test methods in the class have run.

3.@Before :- Is used to run before the @Test methods.

4.@After : Is used to run After the @Test methods.

5.@Test : Is used to run test methods

Basic Annotations of Junit

Before learning the Junit framework. Let’s have a look at why we need to use this Junit, by understanding the usage of Unit Testing Framework.

Understanding of Unit Testing Framework :

What is Unit Testing?
Unit Testing is defined as testing individual units or modules without integrating with other units. Mostly this testing is done by the Developers.

Why do Developers do Unit Testing?

Developers do unit testing to ensure everything is working fine as expected before pushing or deploying the code from developers environment to QA environment.

What is Junit?
JUnit is one of the unit testing frameworks for Java programming Language. JUnit is used for

1.Writing individual Unit Tests.

2.Write multiple unit tests under the Test Suite.

3.Generating the Test Results.

How to install Junit in Eclipse?

Step 1 : Downloading the jars of Junit and Apart from Junit jar file we need to download the hamcrest-core.jar from the below URL

Download JUnit and Install

Step 2 : Creating project in eclipse and adding jar files to the project

JUnit : JUnit is one of the most famous Unit Testing Framework for Java. This JUnit frameworks are used by Developer to Complete their unit testing before moving the build from Development environment to QA environment.

Basic Annotations used in Junit :
1.@BeforeClass – Is used to run only once before executing the test methods in the class.

2.@AfterClass – Is used to run after all the available test methods in the class have run.

3.@Before :- Is used to run before the @Test methods.

4.@After : Is used to run After the @Test methods.

5.@Test : Is used to run test methods

Leave a Comment

Your email address will not be published. Required fields are marked *