All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mockrunner.test.consistency.Launcher Maven / Gradle / Ivy

Go to download

Mockrunner is a lightweight framework for unit testing applications in the J2EE environment. It supports servlets, filters, tag classes and Struts actions. It includes a JDBC a JMS and a JCA test framework and can be used to test EJB based applications.

The newest version!
package com.mockrunner.test.consistency;

import java.lang.reflect.Method;

import junit.framework.Test;
import junit.framework.TestResult;
import junit.framework.TestSuite;
import junit.textui.TestRunner;

public class Launcher
{
    public void run(String testClassName) throws Exception
    {
        Class testClass = this.getClass().getClassLoader().loadClass(testClassName);
        Test test = null;
        if(!Test.class.isAssignableFrom(testClass))
        {
            Method method = testClass.getMethod("suite", null);
            test = (Test)method.invoke(null, null);
        }
        else
        {
            test = new TestSuite(testClass);
        }
        TestResult result = TestRunner.run(test);
        if(!result.wasSuccessful())
        {
            throw new RuntimeException("Test " + testClassName + " failed");
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy