-->

Friday, February 2, 2018

JAVA Application Testing with JUNIT For Beginners - YouTube
src: i.ytimg.com

JUnit is a unit testing framework for the Java programming language. JUnit has been important in the development of test-driven development, and is one of a family of unit testing frameworks which is collectively known as xUnit that originated with SUnit.

JUnit is linked as a JAR at compile-time; the framework resides under package junit.framework for JUnit 3.8 and earlier, and under package org.junit for JUnit 4 and later.

A research survey performed in 2013 across 10,000 Java projects hosted on GitHub found that JUnit, (in a tie with slf4j-api), was the most commonly included external library. Each library was used by 30.7% of projects.


Video JUnit



Example of JUnit test fixture

A JUnit test fixture is a Java object. With older versions of JUnit, fixtures had to inherit from junit.framework.TestCase, but the new tests using JUnit 4 should not do this. Test methods must be annotated by the @Test annotation. If the situation requires it, it is also possible to define a method to execute before (or after) each (or all) of the test methods with the @Before (or @After) and @BeforeClass (or @AfterClass) annotations.


Maps JUnit



Ports

JUnit alternatives have been written in other languages including:

  • Actionscript (FlexUnit)
  • Ada (AUnit)
  • C (CUnit)
  • C# (NUnit)
  • C++ (CPPUnit, CxxTest)
  • Coldfusion (MXUnit)
  • Erlang (EUnit)
  • Eiffel (Auto-Test) - JUnit inspired getest (from Gobosoft), which led to Auto-Test in Eiffel Studio.
  • Fortran (fUnit, pFUnit)
  • Delphi (DUnit)
  • Free Pascal (FPCUnit)
  • Haskell (HUnit)
  • JavaScript (JSUnit)
  • Microsoft .NET (NUnit)
  • Objective-C (OCUnit)
  • OCaml (OUnit)
  • Perl (Test::Class and Test::Unit)
  • PHP (PHPUnit)
  • Python (PyUnit)
  • Qt (QTestLib)
  • R (RUnit)
  • Ruby (Test::Unit)

JUnit Testing in Eclipse - YouTube
src: i.ytimg.com


See also

  • TestNG, another test framework for Java
  • Mock object, a technique used during unit testing
  • Mockito and PowerMock, mocking extensions to JUnit
  • JUnit-Tools, a set of tools to optimize the creation and maintainability of junit-tests (www.junit-tools.org)
  • EvoSuite, a tool to automatically generate JUnit tests

Junit - Test Expected exception,Ignore test and specify timeout ...
src: i.ytimg.com


References


Getting started with JUnit in NetBeans - YouTube
src: i.ytimg.com


External links

  • Official website
  • An early look at JUnit 4
  • JUnit Presentation
  • JUnit Tutorials

Source of article : Wikipedia