Search in sources :

Example 31 with SMTestProxy

use of com.intellij.execution.testframework.sm.runner.SMTestProxy in project intellij-community by JetBrains.

the class SMTestRunnerResultsFormTest method testChangeSelectionAction.

public void testChangeSelectionAction() {
    final Marker onSelectedHappend = new Marker();
    final Ref<SMTestProxy> proxyRef = new Ref<>();
    final Ref<Boolean> focusRequestedRef = new Ref<>();
    myResultsViewer.setShowStatisticForProxyHandler(new PropagateSelectionHandler() {

        @Override
        public void handlePropagateSelectionRequest(@Nullable final SMTestProxy selectedTestProxy, @NotNull final Object sender, final boolean requestFocus) {
            onSelectedHappend.set();
            proxyRef.set(selectedTestProxy);
            focusRequestedRef.set(requestFocus);
        }
    });
    final SMTestProxy suite = createSuiteProxy("suite", myTestsRootNode);
    final SMTestProxy test = createTestProxy("test", myTestsRootNode);
    myResultsViewer.onSuiteStarted(suite);
    myResultsViewer.onTestStarted(test);
    //On test
    myResultsViewer.selectAndNotify(test);
    myResultsViewer.showStatisticsForSelectedProxy();
    assertTrue(onSelectedHappend.isSet());
    assertEquals(test, proxyRef.get());
    assertTrue(focusRequestedRef.get());
    //on suite
    //reset markers
    onSelectedHappend.reset();
    proxyRef.set(null);
    focusRequestedRef.set(null);
    myResultsViewer.selectAndNotify(suite);
    myResultsViewer.showStatisticsForSelectedProxy();
    assertTrue(onSelectedHappend.isSet());
    assertEquals(suite, proxyRef.get());
    assertTrue(focusRequestedRef.get());
}
Also used : SMTestProxy(com.intellij.execution.testframework.sm.runner.SMTestProxy) Ref(com.intellij.openapi.util.Ref) Marker(com.intellij.execution.testframework.sm.Marker)

Example 32 with SMTestProxy

use of com.intellij.execution.testframework.sm.runner.SMTestProxy in project intellij-community by JetBrains.

the class SMTestRunnerResultsFormTest method testCustomProgress_Terminated.

public void testCustomProgress_Terminated() {
    myResultsViewer.onTestingStarted(myTestsRootNode);
    final SMTestProxy test1 = createTestProxy("some_test1", myTestsRootNode);
    myResultsViewer.onTestStarted(test1);
    myResultsViewer.onTestingFinished(myTestsRootNode);
    assertEquals(ColorProgressBar.GREEN, myResultsViewer.getTestsStatusColor());
}
Also used : SMTestProxy(com.intellij.execution.testframework.sm.runner.SMTestProxy)

Example 33 with SMTestProxy

use of com.intellij.execution.testframework.sm.runner.SMTestProxy in project intellij-community by JetBrains.

the class SMTestRunnerResultsFormTest method testOnTestFailure.

public void testOnTestFailure() {
    final SMTestProxy test = createTestProxy(myTestsRootNode);
    myResultsViewer.onTestStarted(test);
    myResultsViewer.onTestFailed(test);
    assertEquals(1, myResultsViewer.getFailedTestCount());
    assertEquals(1, myResultsViewer.getFailedTestCount());
}
Also used : SMTestProxy(com.intellij.execution.testframework.sm.runner.SMTestProxy)

Example 34 with SMTestProxy

use of com.intellij.execution.testframework.sm.runner.SMTestProxy in project intellij-community by JetBrains.

the class SMTestRunnerResultsFormTest method testCustomProgress_EmptySuite.

public void testCustomProgress_EmptySuite() {
    myResultsViewer.onCustomProgressTestsCategory("foo", 0);
    final SMTestProxy suite = createSuiteProxy("some_suite", myTestsRootNode);
    myTestsRootNode.setStarted();
    myResultsViewer.onSuiteStarted(suite);
    suite.setStarted();
    suite.setFinished();
    myResultsViewer.onSuiteFinished(suite);
    myTestsRootNode.setFinished();
    myResultsViewer.onSuiteFinished(myTestsRootNode);
    myResultsViewer.onTestingFinished(myTestsRootNode);
    assertEquals(0, myResultsViewer.getTotalTestCount());
    assertEquals(Color.LIGHT_GRAY, myResultsViewer.getTestsStatusColor());
}
Also used : SMTestProxy(com.intellij.execution.testframework.sm.runner.SMTestProxy)

Example 35 with SMTestProxy

use of com.intellij.execution.testframework.sm.runner.SMTestProxy in project intellij-community by JetBrains.

the class SMTestRunnerResultsFormTest method testCustomProgress_Terminated_SmthFailed.

public void testCustomProgress_Terminated_SmthFailed() {
    myResultsViewer.onTestingStarted(myTestsRootNode);
    final SMTestProxy test1 = createTestProxy("some_test1", myTestsRootNode);
    myResultsViewer.onTestStarted(test1);
    myResultsViewer.onTestFailed(test1);
    myResultsViewer.onTestStarted(createTestProxy("some_test2", myTestsRootNode));
    myResultsViewer.onTestingFinished(myTestsRootNode);
    assertEquals(ColorProgressBar.RED, myResultsViewer.getTestsStatusColor());
}
Also used : SMTestProxy(com.intellij.execution.testframework.sm.runner.SMTestProxy)

Aggregations

SMTestProxy (com.intellij.execution.testframework.sm.runner.SMTestProxy)42 GlobalSearchScope (com.intellij.psi.search.GlobalSearchScope)9 Project (com.intellij.openapi.project.Project)8 Location (com.intellij.execution.Location)6 PsiClass (com.intellij.psi.PsiClass)6 MethodLocation (com.intellij.execution.junit2.info.MethodLocation)5 PsiMemberParameterizedLocation (com.intellij.execution.junit2.PsiMemberParameterizedLocation)4 PsiElement (com.intellij.psi.PsiElement)4 PsiMethod (com.intellij.psi.PsiMethod)4 JavaTestLocator (com.intellij.execution.testframework.JavaTestLocator)3 List (java.util.List)3 AbstractTestProxy (com.intellij.execution.testframework.AbstractTestProxy)2 SMTRunnerTreeStructure (com.intellij.execution.testframework.sm.runner.SMTRunnerTreeStructure)2 Ref (com.intellij.openapi.util.Ref)2 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 Map (java.util.Map)2 NotNull (org.jetbrains.annotations.NotNull)2 ExecutionException (com.intellij.execution.ExecutionException)1 JavaTestConfigurationBase (com.intellij.execution.JavaTestConfigurationBase)1