use of com.theoryinpractice.testng.model.TestData in project intellij-community by JetBrains.
the class TestNGRunnableState method createJavaParameters.
@Override
protected JavaParameters createJavaParameters() throws ExecutionException {
final JavaParameters javaParameters = super.createJavaParameters();
javaParameters.setMainClass("org.testng.RemoteTestNGStarter");
try {
port = NetUtils.findAvailableSocketPort();
} catch (IOException e) {
throw new ExecutionException("Unable to bind to port " + port, e);
}
final TestData data = getConfiguration().getPersistantData();
if (data.getOutputDirectory() != null && !data.getOutputDirectory().isEmpty()) {
javaParameters.getProgramParametersList().add(CommandLineArgs.OUTPUT_DIRECTORY, data.getOutputDirectory());
}
javaParameters.getProgramParametersList().add(CommandLineArgs.USE_DEFAULT_LISTENERS, String.valueOf(data.USE_DEFAULT_REPORTERS));
@NonNls final StringBuilder buf = new StringBuilder();
if (data.TEST_LISTENERS != null && !data.TEST_LISTENERS.isEmpty()) {
buf.append(StringUtil.join(data.TEST_LISTENERS, ";"));
}
collectListeners(javaParameters, buf, IDEATestNGListener.EP_NAME, ";");
if (buf.length() > 0)
javaParameters.getProgramParametersList().add(CommandLineArgs.LISTENER, buf.toString());
createServerSocket(javaParameters);
createTempFiles(javaParameters);
return javaParameters;
}
use of com.theoryinpractice.testng.model.TestData in project intellij-community by JetBrains.
the class DetectClassesToRunTest method doTestClassConfiguration.
private void doTestClassConfiguration(PsiClass aClass) throws CantRunException {
final TestNGConfiguration configuration = new TestNGConfiguration("TestA", getProject(), TestNGConfigurationType.getInstance().getConfigurationFactories()[0]);
final TestData data = configuration.getPersistantData();
data.TEST_OBJECT = TestType.CLASS.getType();
data.setScope(TestSearchScope.SINGLE_MODULE);
configuration.setModule(data.setMainClass(aClass));
final TestNGTestObject testObject = TestNGTestObject.fromConfig(configuration);
assertNotNull(testObject);
final LinkedHashMap<PsiClass, Map<PsiMethod, List<String>>> classes = new LinkedHashMap<>();
testObject.fillTestObjects(classes);
assertContainsElements(classes.keySet(), aClass);
assertEquals(1, classes.size());
}
use of com.theoryinpractice.testng.model.TestData in project intellij-community by JetBrains.
the class DetectClassesToRunTest method doTestPackageConfiguration.
private void doTestPackageConfiguration(PsiClass... containingClasses) throws CantRunException {
final TestNGConfiguration configuration = new TestNGConfiguration("p", getProject(), TestNGConfigurationType.getInstance().getConfigurationFactories()[0]);
final TestData data = configuration.getPersistantData();
data.TEST_OBJECT = TestType.PACKAGE.getType();
data.PACKAGE_NAME = "p";
data.setScope(TestSearchScope.WHOLE_PROJECT);
final TestNGTestObject testObject = TestNGTestObject.fromConfig(configuration);
assertNotNull(testObject);
final LinkedHashMap<PsiClass, Map<PsiMethod, List<String>>> classes = new LinkedHashMap<>();
testObject.fillTestObjects(classes);
assertContainsElements(classes.keySet(), containingClasses);
for (PsiClass psiClass : containingClasses) {
assertEmpty(classes.get(psiClass).keySet());
}
}
Aggregations