Lab3 JUnit
Lab3 JUnit
JUnit Annotations
Unit Testing focuses on writing automated tests for individual classes and methods.
This software testing approach is followed by the programmer to test the unit of the program. It
helps developers to know whether the individual unit of the code is working properly or not.
The important thing about unit testing is that these tests can be run with continuous integration
- as soon as some code changes.
What is JUnit?
JUnit is an open-source Unit Testing Framework for Java programming language.
JUnit has been important in the development of test-driven development.
It is one of a family of unit testing frameworks collectively known as xUnit, that originated with
JUnit.
As the name suggests it is used for testing small chunk of code or unit by creating a path,
function or a method.
Advantages and uses
It finds bugs early in the code, which makes our code more reliable.
You develop more readable, reliable and bug-free code which builds confidence during development.
Best testing framework that can be selected for Efficient testing process
JUnit test Frameworks enables it to test within the application server’s container
Provides annotations to identify test methods and assertion statements for testing expected results.
TestJunit2.class })
public class JunitTestSuite
{ }
Test Runners:
Test runner is used for executing the test cases.
RunClasses method is used to run one or several test cases.
Return type of this method is the result object that is used to access information about the
tests.
Set JDK Path Set Path of JDK in your system by setting Java Environment and ClassPath variable
Download & Install Java IDE eg: Eclipse(recommended), Intellij. Link to download Eclipse:
Download & Install IDE
https://www.eclipse.org/downloads/packages/release/helios/sr1/eclipse-ide-java-developers