com.sun.maven.junit
Class LocalTestCaseRunner

java.lang.Object
  extended by com.sun.maven.junit.LocalTestCaseRunner
All Implemented Interfaces:
TestCaseRunner, Serializable

public class LocalTestCaseRunner
extends Object
implements TestCaseRunner, Serializable

TestCaseRunner that runs tests on the current JVM.

This object can be also sent to a remote channel to execute tests over there.

Author:
Kohsuke Kawaguchi
See Also:
Serialized Form

Constructor Summary
LocalTestCaseRunner(File reportDirectory)
           
 
Method Summary
 junit.framework.Test buildTestCase(String fileName)
           
 TestCaseRunner copyTo(hudson.remoting.Channel channel)
          Creates a clone on the given channel and returns a proxy to it.
protected  boolean isTest(Class c)
           
 void redirectToDevNull()
          Redirects the stdout/stderr to /dev/null.
 Result runTestCase(String fileName)
          Runs a single test case and returns the result.
 Result runTestCase(String fileName, String methodName)
           
 junit.framework.TestResult runTests(junit.framework.Test all, PrintStream report)
          Run tests and send the progress report to the given PrintStream.
 void setUp(List<URL> classpath, boolean quiet)
          Prepares for the test execution.
 void tearDown()
          The clean up that pairs with TestCaseRunner.setUp(List, boolean)
protected  String toClassName(String name)
          Converts a file name of a class file to a class name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalTestCaseRunner

public LocalTestCaseRunner(File reportDirectory)
Method Detail

setUp

public void setUp(List<URL> classpath,
                  boolean quiet)
Description copied from interface: TestCaseRunner
Prepares for the test execution.

Specified by:
setUp in interface TestCaseRunner

runTestCase

public Result runTestCase(String fileName)
Description copied from interface: TestCaseRunner
Runs a single test case and returns the result.

Specified by:
runTestCase in interface TestCaseRunner
Parameters:
fileName - File name of the test case class, relative to the class directory root.

runTestCase

public Result runTestCase(String fileName,
                          String methodName)

redirectToDevNull

public void redirectToDevNull()
Redirects the stdout/stderr to /dev/null. This method doesn't actually belong here but it's convenient to do this.


buildTestCase

public junit.framework.Test buildTestCase(String fileName)

runTests

public junit.framework.TestResult runTests(junit.framework.Test all,
                                           PrintStream report)
Run tests and send the progress report to the given PrintStream.


tearDown

public void tearDown()
Description copied from interface: TestCaseRunner
The clean up that pairs with TestCaseRunner.setUp(List, boolean)

Specified by:
tearDown in interface TestCaseRunner

isTest

protected boolean isTest(Class c)

toClassName

protected String toClassName(String name)
Converts a file name of a class file to a class name.


copyTo

public TestCaseRunner copyTo(hudson.remoting.Channel channel)
                      throws IOException,
                             InterruptedException
Creates a clone on the given channel and returns a proxy to it.

Throws:
IOException
InterruptedException


Copyright © 2011. All Rights Reserved.