Function runTestOnWorker
Runs a test on the current worker thread and reports its begin, failure and end to the proxy
void runTestOnWorker(
string key,
void delegate() func,
shared(trial .executor .parallel .ThreadProxy) proxy
);
Example
runTestOnWorker reports one begin, one end and the failure of a throwing test
auto oldListeners = LifeCycleListeners .instance;
auto oldProxy = ThreadLifeCycleListener .currentProxy;
scope(exit) {
LifeCycleListeners .instance = oldListeners;
ThreadLifeCycleListener .currentProxy = oldProxy;
}
auto proxy = new shared ThreadProxy;
runTestOnWorker("suite1|test1", delegate() @system { throw new Exception("failed"); }, proxy);
auto status = proxy .getStatus;
status .begin .length .should .equal(1);
(cast(string[]) status .end) .should .equal(["suite1|test1"]);
(cast(Throwable[string]) status .failures) .keys .should .equal(["suite1|test1"]);
ThreadLifeCycleListener .currentTest .should .equal("");