use of com.intellij.psi.PsiClass in project intellij-community by JetBrains.
the class DetectClassesToRunTest method testDependsOnGroupDontIncludeForeignClass.
@Test
public void testDependsOnGroupDontIncludeForeignClass() throws Exception {
final PsiClass aClass = myFixture.addClass("package a; public class ATest {" + " @org.testng.annotations.Test(groups = { \"g1\" })\n" + " public void testTwo(){}\n " + " @org.testng.annotations.Test(dependsOnGroups = {\"g1\" })\n" + " public void testOne(){}\n" + "}");
myFixture.addClass("package a; public class ForeignTest {" + " @org.testng.annotations.Test(groups = { \"g1\" })\n" + " public void testForth(){}\n " + "}");
doTestClassConfiguration(aClass);
}
use of com.intellij.psi.PsiClass in project intellij-community by JetBrains.
the class DetectClassesToRunTest method testOneMethodWhenAnnotationIsOnBaseClassOnly.
@Test
public void testOneMethodWhenAnnotationIsOnBaseClassOnly() throws Exception {
myFixture.addClass("package a; @org.testng.annotations.Test public class BaseClass {}");
final PsiClass aClass = myFixture.addClass("package a; public class ATest extends BaseClass {" + " public void testOne(){}\n" + "}");
doTestMethodConfiguration(aClass, aClass.getMethods());
}
use of com.intellij.psi.PsiClass in project intellij-community by JetBrains.
the class DetectClassesToRunTest method testRerunFailedTestWithDependency.
public void testRerunFailedTestWithDependency() throws Exception {
final PsiClass aClass = myFixture.addClass("package a; public class ATest {" + " @org.testng.annotations.Test()\n" + " public void testTwo(){}\n " + " @org.testng.annotations.Test(dependsOnMethods = \"testTwo\")\n" + //parameterized
" public void testOne(String s){}\n" + "}");
final LinkedHashMap<PsiClass, Map<PsiMethod, List<String>>> classes = new LinkedHashMap<>();
classes.put(aClass, new HashMap<>());
final GlobalSearchScope projectScope = GlobalSearchScope.projectScope(getProject());
final SMTestProxy testProxy = new SMTestProxy("testOne", false, "java:test://a.ATest.testOne[a]");
testProxy.setLocator(new JavaTestLocator());
RerunFailedTestsAction.includeFailedTestWithDependencies(classes, projectScope, getProject(), testProxy);
assertEquals(1, classes.size());
final Map<PsiMethod, List<String>> params = classes.get(aClass);
assertContainsElements(params.keySet(), aClass.getMethods());
final List<String> paramsToRerun = params.get(aClass.findMethodsByName("testOne", false)[0]);
assertEquals(1, paramsToRerun.size());
assertContainsElements(paramsToRerun, "a");
}
use of com.intellij.psi.PsiClass in project intellij-community by JetBrains.
the class GroupBrowser method showDialog.
@Nullable
@Override
protected String showDialog() {
TestClassFilter filter;
Module module = editor.getModuleSelector().getModule();
if (module == null) {
filter = new TestClassFilter(GlobalSearchScope.projectScope(getProject()), getProject(), false);
} else {
filter = new TestClassFilter(GlobalSearchScope.moduleScope(module), getProject(), false);
}
PsiClass[] classes = TestNGUtil.getAllTestClasses(filter, true);
if (classes == null || classes.length == 0) {
Messages.showMessageDialog(getField(), "No tests found in project", "Cannot Browse Groups", Messages.getInformationIcon());
return null;
} else {
return GroupList.showDialog(classes, getField());
}
}
use of com.intellij.psi.PsiClass in project intellij-community by JetBrains.
the class TestClassBrowser method showDialog.
@Override
protected String showDialog() {
ClassFilter.ClassFilterWithScope filter;
try {
filter = getFilter();
} catch (MessageInfoException e) {
MessagesEx.MessageInfo message = e.getMessageInfo();
message.showNow();
return null;
}
TreeClassChooser chooser = TreeClassChooserFactory.getInstance(getProject()).createWithInnerClassesScopeChooser("Choose Test Class", filter.getScope(), filter, null);
init(chooser);
chooser.showDialog();
PsiClass psiclass = chooser.getSelected();
if (psiclass == null) {
return null;
} else {
onClassChoosen(psiclass);
return psiclass.getQualifiedName();
}
}
Aggregations