Class RemoteCapableRunner
java.lang.Object
org.junit.runner.Runner
com.onenetwork.platform.tools.test.junit4.RemoteCapableRunner
- All Implemented Interfaces:
org.junit.runner.Describable
- Direct Known Subclasses:
ForwardingRemoteRunner
public abstract class RemoteCapableRunner
extends org.junit.runner.Runner
Base class for JUnit 4 test runners that execute tests on remote JVM.
It is assumed that client and server machine have same test classes and, to a certain extent, same runner implementations. If this assumption does not hold, result of a test execution is undefined.
It is assumed that client and server machine have same test classes and, to a certain extent, same runner implementations. If this assumption does not hold, result of a test execution is undefined.
- Since:
- 20.0
-
Constructor Summary
Constructors Constructor Description RemoteCapableRunner(java.lang.Class<?> testCls)
-
Method Summary
Modifier and Type Method Description protected abstract void
doRunOnServer(org.junit.runner.notification.RunNotifier notifier)
This method must be implemented to execute the tests when this method is called.protected void
execute(org.junit.runner.notification.RunNotifier notifier, org.junit.runners.model.TestClass testCls, org.junit.runner.Description testDescription)
Execute a request to server to execute a test that is described bytestDescription
parameter.protected RemoteTestExecutor
executor()
protected org.junit.runners.model.TestClass
getTestClass()
protected abstract RemoteTestExecutor
initExecutor()
Initiates atest executor
object responsible for sending test execution requests to remote server.protected boolean
isRunningOnServer()
Runner status method to check whether current thread can be considered "server side" of the current test run.void
run(org.junit.runner.notification.RunNotifier notifier)
abstract void
runOnClient(org.junit.runner.notification.RunNotifier notifier)
Invoked to run tests on the side of a client machine.void
runOnServer(org.junit.runner.notification.RunNotifier notifier)
Invoked to run test on the side of a server machine.
-
Constructor Details
-
RemoteCapableRunner
public RemoteCapableRunner(java.lang.Class<?> testCls)
-
-
Method Details
-
runOnClient
public abstract void runOnClient(org.junit.runner.notification.RunNotifier notifier)Invoked to run tests on the side of a client machine. Implementations are expected to not actually run tests when this method invoked, but instead send a test execution request(s) to remote server.- Parameters:
notifier
-client-side test run observer
-
runOnServer
public final void runOnServer(org.junit.runner.notification.RunNotifier notifier)Invoked to run test on the side of a server machine.- Parameters:
notifier
-server-side test run observer
-
doRunOnServer
protected abstract void doRunOnServer(org.junit.runner.notification.RunNotifier notifier)This method must be implemented to execute the tests when this method is called.
Implementors can assume server environment.
- Parameters:
notifier
-server-side test run observer
-
run
public void run(org.junit.runner.notification.RunNotifier notifier)- Specified by:
run
in classorg.junit.runner.Runner
- See Also:
Runner.run(org.junit.runner.notification.RunNotifier)
-
getTestClass
protected org.junit.runners.model.TestClass getTestClass() -
execute
protected void execute(org.junit.runner.notification.RunNotifier notifier, org.junit.runners.model.TestClass testCls, org.junit.runner.Description testDescription)Execute a request to server to execute a test that is described bytestDescription
parameter.- Parameters:
notifier
-test run observer
testCls
- a framework test class.test
- description of a test that should be executed remotely
-
initExecutor
Initiates atest executor
object responsible for sending test execution requests to remote server.- Returns:
-
executor
-
isRunningOnServer
protected final boolean isRunningOnServer()Runner status method to check whether current thread can be considered "server side" of the current test run.
For it to return true, the
runOnServer
method has to be invoked at least once during the run.- Returns:
- whether we are executing on "the server".
-