Developer(s) | Kent Beck, Erich Gamma, David Saff |
---|---|
Stable release | 4.10[1] / September 29, 2011 |
Written in | Java |
Operating system | Cross-platform |
Type | Unit testing tool |
License | Common Public License |
Website | junit.sourceforge.net |
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 collectively known as xUnit that originated with SUnit.
JUnit is linked as a JAR at compile-time; the framework resides under packages junit.framework
for JUnit 3.8 and earlier and under org.junit
for JUnit 4 and later.
Contents |
A JUnit Test fixture is a Java object. With older versions of JUnit, fixtures had to inherit from junit.framework.TestCase
, but new tests using JUnit 4 should not do this.[2] Test methods must be annotated by the @Test
annotation. If the situation requires it,[3] 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.[4]
<source lang="java"> import org.junit.*;
public class TestFoobar{
@BeforeClass public static void setUpClass() throws Exception { // Code executed before the first test method }
@Before public void setUp() throws Exception { // Code executed before each test } @Test public void testOneThing() { // Code that tests one thing }
@Test public void testAnotherThing() { // Code that tests another thing }
@Test public void testSomethingElse() { // Code that tests something else } @After public void tearDown() throws Exception { // Code executed after each test } @AfterClass public static void tearDownClass() throws Exception { // Code executed after the last test method }
} </source>
JUnit has been ported to other languages including:
Iunit was a minor goddess in ancient Egyptian religion, whose name means "She of Armant". She is the consort of Montu.
Hey, like a fallen angel I was on your side
You lighted the fire deep in my soul
Do you remember the stars shining bright?
I should retire under your control
In seven nights and days
Oh, you didn't think your thing would come crashing down
In seven lonely dreams
Oh, I know that you're not the one I'm waiting for
Seven nights, seven days
Seven nights, I carried the can
'Cause I let you go, all our bridges were burned
Oh boy, it's on the cards, I don't wanna return
Seven nights, seven days
Seven nights, you blew your chance
Love was not forever in your heart
Due to that we have to live apart
Nothing's forever, no use to try
There's no solution, don't make me blue
We tried together, I kiss you goodbye
This endless confusion should not come true
In seven nights and days
Oh, you didn't think your thing would come crashing down
In seven lonely dreams
Oh, I know that you're not the one that I'm waiting for
Seven nights, seven days
Seven nights, I carried the can
'Cause I let you go, all our bridges were burned
Oh boy, it's on the cards, I don't wanna return
Seven nights, seven days
Seven nights, you blew your chance
Love was not forever in your heart
Due to that we have to live apart
Seven nights, seven days
Seven nights, I carried the can
'Cause I let you go, all our bridges were burned
Oh boy, it's on the cards, I don't wanna return
Seven nights, seven days
Seven nights, you blew your chance
Love was not forever in your heart
Due to that we have to live apart