JUnit

Daripada Wikipedia, ensiklopedia bebas.

JUnit ialah sebuah rangka kerja pengujian unit untuk bahasa pengaturcaraan Java.

Contoh:

import org.junit.*;

public class FoobarTest {
    @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 
    }
}

Pautan luar[sunting | sunting sumber]


Jika anda melihat rencana yang menggunakan templat {{tunas}} ini, gantikanlah ia dengan templat tunas yang lebih spesifik.