Reading:  

Working with JUnit


What is JUnit?

Testing is the method of checking the functionality of the product whether it is working according to the requirements or not. Unit testing is to ensure the quality of product at developer level.

Two ways to achieve Unit Testing:

  • Manual Testing
  • Automated Testing

Generally Automated testing is a preferred way of these methods, because you can run very complex tests repeatedly over time without any human interaction while a test is running.

Here are some key points to show you how Manual testing and Automated testing differs

Manual Testing

Testing the application manually is called manual testing.

  • It is completely done by human
    hence it takes more time to test 
  • It requires more human resources: because test cases need to be manually executed so more testers are
    required in manual testing.
  • No coding can be done to prepare complicated tests which fetch hidden information.

Automated Testing

Testing the application by using tools is called automation testing.

  • This is done with the help of a testing tool which reduces human power hence it consume less time to test
  • Test cases are executed with the help of automation tool so no more testers are required. 
  • Testers can prepare complicated tests scripts to fetch hidden information.
  • JUnit is an open source framework which is used for preparing & executing test scripts.
  • Junit test method must be specified with “annotations”
  • Junit test methods can be validated using “Asserts”
  • JUnit tests allow you to write code faster which increasing quality
  • JUnit is easy to implement. It is less complex & takes less time.
  • Junit allows for sharing common test data
  • Junit allows to Test suites organizing and running tests
  • Junit shows graphical user interface result which makes easy to analyses the test progress in a bar is green when test pass and it turns red when a test fails.

JUnit Framework:

Junit is a programmer oriented testing framework for the Java.It is a white box testing framework is used to test the business logic of the application.

Junit is a unit testing framework which uses annotation to identify the methods that specify a test.

JUnit is an open source framework which is used for preparing & executing test scripts.

Some key points on Junit:

  • Junit test methods must be specified with "annotations"
  • Junit test methods can be validated using "Asserts"
  • JUnit tests allow you to write code faster which increasing quality
  • JUnit is easy to implement. It is less complex & takes less time.
  • Junit allows for sharing common test data
  • Junit allows to Test suites organizing and running tests
  • Junit shows graphical user interface result which makes easy to analyses the test progress in a bar is green when test pass and it turns red when a test fails.

 

Description

Junit is a programmer oriented testing framework for the Java. It is a white box testing framework is used to test the business logic of the application. This tutorial is focused on getting you started with latest of JUnit.This tutorial is divided in multiple parts as shown below

  • What is JUnit?
  • Environment Setup
  • Test Framework
  • API
  • Annotations
  • Suite Test
  • Working with Exceptions in Junit 
  • Parametrized Test
  • Plug with ANT
  • Working in command line
  • Extensions

 

Send through your feedback and we hope that you will learn quite a bit from this tutorial especially if you are getting started with JUnit or just brushing up your knowledge



Prerequisites

Java programming language

Audience

Beginners or students looking to brush up their JUnit skills quickly

Learning Objectives

Students looking to getting started with JUnit

Author: Subject Coach
Added on: 13th Mar 2015

You must be logged in as Student to ask a Question.

None just yet!