Bug 25324 Ability to know when tests are finished [junit]
Hi, I'm writing a Cactus Plugin that extends the JUnit Plugin and I need to know when the tests have finished running in the TestRunner. There is a nice ITestRunListener interface for that. My idea was thus to implement this interface and somehow register my listener to the TestRunner (RemoteTestRunnerClient). However: 1/ Currently the RemoteTestRunnerClient implementation only supports one listener 2/ There is no API in TestRunnerViewPart to get access to the TestRunner I am attaching a patch that should provide this facility. However, I need your help to know if this is the right approach or not. Thank you -Vincent
org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/RemoteTestRunnerClient.java
long elapsedTime= Long.parseLong(arg);
			fListener.testRunStopped(elapsedTime);
			shutDown();
			return;
		}
		if (message.startsWith(MessageIds.TEST_TREE)) {
			fListener.testTreeEntry(arg);
			return;
		}
		if (message.startsWith(MessageIds.TEST_RERAN)) {
			
			
			int c= arg.indexOf(" "); 
			int t= arg.indexOf(" ", c+1); 
			String className= arg.substring(0, c);
			String testName= arg.substring(c+1, t);
			String status= arg.substring(t+1);
			int statusCode= ITestRunListener.STATUS_OK;
			if (status.equals("FAILURE")) 
				statusCode= ITestRunListener.STATUS_FAILURE;
			else if (status.equals("ERROR")) 
				statusCode= ITestRunListener.STATUS_ERROR;
				
			String trace= ""; 
			if (statusCode != ITestRunListener.STATUS_OK)
				trace= fFailedRerunTrace; 
			fListener.testReran(className, testName, statusCode, trace);
		}
	}
}