Talk:JUnit

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Advertising[edit]

This page seems a lot like an ad.

  • Probably because it was taken straight from an article. See below.

sdf Um, possible plagiarism alert: the first paragraph reads very much like this paragraph from an IBM website:

"JUnit is the de facto standard unit testing library for the Java™ language. ... JUnit, developed by Kent Beck and Erich Gamma, is almost indisputably the single most important third-party Java library ever developed. As Martin Fowler has said, "Never in the field of software development was so much owed by so many to so few lines of code." JUnit kick-started and then fueled the testing explosion. Thanks to JUnit, Java code tends to be far more robust, reliable, and bug free than code has ever been before. JUnit (itself inspired by Smalltalk's SUnit) has inspired a whole family of xUnit tools bringing the benefits of unit testing to a wide range of languages. nUnit (.NET), pyUnit (Python), CppUnit (C++), dUnit (Delphi), and others have test-infected programmers on a multitude of platforms and languages."

http://www-128.ibm.com/developerworks/java/library/j-junit4.html?ca=dgr-lnxw01JUnit4

In fact, most of the article seems to be plagiarized from the IBM page. I'm removing the plagiarized parts.

do we say Junit or JUnit ?

JUnit. And yes, it is really very important. I make my students use it :) I'll see if I can fix anything. --WiseWoman (talk) 14:41, 30 June 2008 (UTC)[reply]

Typical Use of JUnit[edit]

The code example provided as a "Hello World" implementation of sorts appears that it really doesn't emphasize the benefits of unit testing nor is it a typical example. Rather, a better code example may appear as:

"Multiplier" example in JUnit:

 public class MultiplierTest extends TestCase
 {
   public void testMultiplication()
   {
     // Testing if the Multiplier class agrees that, 2*2=4:
     assertEquals ("Multiplication", 4, Multiplier.multiply (2, 2) );
      Log.i("LOG", "this is sample page!");
   }
 }

There are several issues to consider here: 1) Wikipedia programming language articles usually present an example of the source code in the form of the customary "Hello World" process. However, JUnit is not a programming language. Instead, 2) JUnit has conventions: it is conventional to see test case class names end with "Test", as well as the prefix name specified as the name of the class being tested. Also, something more meaningful is usually printed in the assertion message (probably not "Multiplication"). 3) Albeit, the original example does offer a fundamental test using only the framework and the core of the Java virtual machine and language specifications. 4) Unit testing is an attempt to test something else, by usually creating a code unit to test another code unit. In the original example, perhaps this was to test the virtual machine's ability to multiply 2 and 2. This compares well with the Mauve article as it is sited for comparison after the example. Unfortunately, 5) typical unit tests execute other code bodies outside of the virtual machine, and most frequently, developer created application (client or server) code units as suggested in the example above. Lastly, 6) application code units are mere clients of the JVM's services. A common objective of a JUnit test is to ascertain the ability of the application code unit to consume/manipulate those services properly to achieve the desired end state or requirement. A JUnit test rarely tests the JVM's services directly.

The original example appears to miss the point of JUnit in practice and as a consequence does not offer much redeeming value to the reader. The example offered above seems to reflect a more common/characteristic perspective of what [Java] unit testing seeks to accomplish. I'm not saying that JUnit testing can't be used to test the JVM as this obviously is a practice - yet this practice isn't nearly as common. 71.253.210.107 04:46, 24 February 2006 (UTC)[reply]

These are all very important points and need to be in the article! --WiseWoman (talk) 14:41, 30 June 2008 (UTC)[reply]

j2meunit[edit]

http://j2meunit.sourceforge.net/ Mathiastck 23:42, 21 August 2006 (UTC)[reply]

Origins of JUnit/SUnit[edit]

The article states that "...the xUnit family of frameworks that originated with Kent Beck's SUnit." While that is at least partially true, there are is at least one ancestor that should be discussed: the Taligent Test Framework. I've written about its history on my blog:

http://shebanation.com/2007/08/21/a-brief-history-of-test-frameworks/

David McCusker, who was the primary author of the Taligent Test Framework, has posted a followup on his own blog:

http://www.briarpig.com/log/aug07.html#test-frameworks

--Ashebanow 13:36, 22 August 2007 (UTC)[reply]

Note that neither of these two URLs works any longer. I'm not sure what happened to briarpig.com, but my domain got hijacked by a squatter. The new url is:

http://shebanator.com/2007/08/21/a-brief-history-of-test-frameworks/

--Ashebanow 23:01, 21 August 2013 (UTC)[reply]

This article is written for the cognoscenti, not for someone unfamiliar with the topic. Randomcoolzip (talk) 01:07, 14 November 2008 (UTC)[reply]

Language Port[edit]

xUnit has been ported to C# (see the website: http://www.nunit.org/index.php) —Preceding unsigned comment added by 146.176.61.100 (talk) 15:40, 19 November 2008 (UTC)[reply]

What year was JUnit originally made? —Preceding unsigned comment added by 96.26.215.52 (talk) 02:03, 13 December 2008 (UTC)[reply]


Additions[edit]

  • role in test first and agile programming
  • the expert use of design patterns in the JUnit project.
  • concurrent testing
  • old assertTrue()
  • new hamacrest matchers in assertThat
  • theories, assumptions format
  • inline assertion for verifying testedness of code. — Preceding unsigned comment added by OrenBochman (talkcontribs) 13:53, 27 January 2012 (UTC)[reply]
  • Mention JMockit mocking library (http://jmockit.github.io/) — Preceding unsigned comment added by Boris Brodski (talkcontribs) 12:21, 2 October 2014 (UTC)[reply]

Ports[edit]

If JUnit is not the original xUnit (article implies sUnit was) then does the list of "Ports" belong here? Are these Ports of JUnit or frameworks inspired by SUnit? This list probably more properly belongs on the xUnit page Dichohecho (talk) 14:22, 6 December 2019 (UTC)[reply]

To say that "sUnit was first" would raise eyebrows, to say the least. It may well have been, but it was JUnit which achieved mass traction and popularised the concept. sUnit is itself pretty late and testing frameworks like this can be traced back to the early '90s, although the technique was obscure and none of those frameworks were being shared between projects or teams. The ancestry of the expansion if through JUnit, not sUnit, even if JUnit itself derived from sUnit. Andy Dingley (talk) 14:44, 6 December 2019 (UTC)[reply]