Junit

package junit3_8;

import junit.framework.TestCase;

public class MyTest extends TestCase {
    public void testSimpleAdd() {
        assertTrue(true);
        assertTrue(false);
    }
}
package junit3_8;

import junit.textui.TestRunner;

/**
 * Hello world!
 *
 */
public class App 
{
    public static void main( String[] args )
    {
        String[] a = {"junit3_8.MyTest"};
        TestRunner.main(a);
    }
}
package junit4_8;

import static org.junit.Assert.*;

import org.junit.Test;

public class Mytest {
    @Test public void simpleAdd() {
        assertTrue(true);
        assertTrue(false);
    }
}
package junit4_8;

import org.junit.runner.JUnitCore;

/**
 * Hello world!
 *
 */
public class App 
{
    public static void main( String[] args )
    {
        String[] a = {"junit4_8.Mytest"};
        JUnitCore.main(a);
    }
}
原文地址:https://www.cnblogs.com/wind90/p/5011144.html