testng: fire configuration started if configuration listener is available

This commit is contained in:
Anna Kozlova
2016-09-06 18:46:48 +03:00
parent f25934aab9
commit 4a8ce92726
@@ -86,17 +86,16 @@ public class IDEARemoteTestNG extends TestNG {
addListener((Object)new IDEATestNGSuiteListener(listener));
addListener((Object)new IDEATestNGTestListener(listener));
try {
Class<?> aClass = Class.forName("org.testng.IDEATestNGInvokedMethodListener");
Object invokedMethodListener = aClass.getConstructor(new Class[]{IDEATestNGRemoteListener.class}).newInstance(listener);
addListener((Object)invokedMethodListener);
}
catch (Throwable ignore){}
try {
Class<?> aClass = Class.forName("org.testng.IDEATestNGConfigurationListener");
Object configurationListener = aClass.getConstructor(new Class[] {IDEATestNGRemoteListener.class}).newInstance(listener);
Class<?> configClass = Class.forName("org.testng.IDEATestNGConfigurationListener");
Object configurationListener = configClass.getConstructor(new Class[] {IDEATestNGRemoteListener.class}).newInstance(listener);
addListener((Object)configurationListener);
aClass.getMethod("setIgnoreStarted").invoke(configurationListener);
Class<?> invokeClass = Class.forName("org.testng.IDEATestNGInvokedMethodListener");
Object invokedMethodListener = invokeClass.getConstructor(new Class[]{IDEATestNGRemoteListener.class}).newInstance(listener);
addListener((Object)invokedMethodListener);
//start with configuration started if invoke method listener was not added, otherwise with
configClass.getMethod("setIgnoreStarted").invoke(configurationListener);
}
catch (Throwable ignored) {}
}