package com.wsdjeg.util;

import java.lang.reflect.Constructor;
import java.lang.reflect.Method;

public class TestMethod{
    public static void main(String[] args) {
        if(args.length == 2){
            testSpecifiedMethod(args[0],args[1]);
        }else if (args.length == 1) {
            testAllMethods(args[0]);
        }else if (args.length > 2){
            testMethods(args);
        }
    }
    public static void testAllMethods(String className){
        Class<?> clazz = null;
        try {
            clazz = Class.forName(className);
        } catch(Exception e){
            e.printStackTrace();
        }
        Method[] mds = clazz.getMethods();
        for (int i = 0; i < mds.length; i++) {
            if (mds[i].getName().startsWith("test")) {
                testSpecifiedMethod(className,mds[i].getName());
            }
        }
    }
    public static void testMethods(String[] args) {
        for (int i = 1; i < args.length; i++) {
            testSpecifiedMethod(args[0],args[i]);
        }
    }
    @SuppressWarnings("unchecked")
    public static void testSpecifiedMethod(String className,String methodName){
        try{
            System.out.println("======================================================================");
            System.out.println("startting : className:" + className + " methodName :"+ methodName + "()" );
            System.out.println("============================= OUTPUT =================================");
            Class<?> clazz = Class.forName(className);
            Constructor<?> c = clazz.getDeclaredConstructor();
            c.setAccessible(true);
            clazz.getMethod(methodName).invoke(c.newInstance());
            System.out.println("============================= SUCCESS ================================");
        }catch(Exception e){
            System.out.println("============================= FAILED ================================");
            e.printStackTrace();
        }
    }
}

@@ -1211,32 +1211,32 @@
 ========
-================
+ JavaUnite Test 
 ========
@@ -1296,61 +1296,71 @@
 ln(%22
-startting : className:%22 + className + %22 methodName 
+CLASS:%22 + className);%0A            System.out.println(%22METHOD
 :%22
+ 
 + me
@@ -1374,17 +1374,16 @@
 e + %22()%22
- 
 );%0A     
@@ -1632,24 +1632,81 @@
 ible(true);%0A
+            long startTime = System.currentTimeMillis();%0A
             
@@ -1754,24 +1754,79 @@
 nstance());%0A
+            long endTime = System.currentTimeMillis();%0A
             
@@ -1865,40 +1865,50 @@
 ====
-=
-============ SUCCESS ==========
+ SUCCESS: %22 + (endTime - startTime) + %22ms 
 ====

Add time