Search in sources :

Example 26 with SMTestProxy

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

the class SMTRunnerFiltersTest method testShowIgnoredHidePassed.

public void testShowIgnoredHidePassed() {
    TestConsoleProperties.HIDE_PASSED_TESTS.set(myProperties, true);
    final SMTRunnerTreeStructure treeStructure = myResultsForm.getTreeBuilder().getSMRunnerTreeStructure();
    final Object[] suites = treeStructure.getChildElements(mySuite);
    assertTrue(suites.length == 1);
    final Object[] tests = treeStructure.getChildElements(suites[0]);
    assertTrue(tests.length == 1);
    assertTrue(tests[0] instanceof SMTestProxy && "testIgnored1".equals(((SMTestProxy) tests[0]).getName()));
}
Also used : SMTestProxy(com.intellij.execution.testframework.sm.runner.SMTestProxy) SMTRunnerTreeStructure(com.intellij.execution.testframework.sm.runner.SMTRunnerTreeStructure)

Example 27 with SMTestProxy

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

the class SMTRunnerUIActionsHandlerTest method testSelectFirstDeffect_Error.

public void testSelectFirstDeffect_Error() {
    TestConsoleProperties.SELECT_FIRST_DEFECT.set(myProperties, true);
    mySuite.setStarted();
    final SMTestProxy testsSuite = createSuiteProxy("my suite", mySuite);
    testsSuite.setStarted();
    // passed test
    final SMTestProxy testPassed1 = createTestProxy("testPassed1", testsSuite);
    testPassed1.setStarted();
    //failed test
    final SMTestProxy testError = createTestProxy("testError", testsSuite);
    testError.setStarted();
    myUIActionsHandler.onTestNodeAdded(myResultsViewer, testError);
    assertNull(mySelectedTestProxy);
    testError.setTestFailed("", "", true);
    //myUIActionsHandler.onTestFinished(testFailed1);
    assertNull(mySelectedTestProxy);
    // passed test numer 2
    mySelectedTestProxy = null;
    final SMTestProxy testPassed2 = createTestProxy("testPassed2", testsSuite);
    testPassed2.setStarted();
    myUIActionsHandler.onTestNodeAdded(myResultsViewer, testPassed2);
    assertNull(mySelectedTestProxy);
    testPassed2.setFinished();
    //myUIActionsHandler.onTestFinished(testPassed2);
    assertNull(mySelectedTestProxy);
    //failed test
    final SMTestProxy testFailed2 = createTestProxy("testFailed1", testsSuite);
    testFailed2.setStarted();
    myUIActionsHandler.onTestNodeAdded(myResultsViewer, testFailed2);
    assertNull(mySelectedTestProxy);
    testFailed2.setTestFailed("", "", false);
    //myUIActionsHandler.onTestFinished(testFailed2);
    assertNull(mySelectedTestProxy);
    // finish suite
    testsSuite.setFinished();
    assertNull(mySelectedTestProxy);
    //testing finished
    mySuite.setFinished();
    assertNull(mySelectedTestProxy);
    myUIActionsHandler.onTestingFinished(myResultsViewer);
    assertEquals(testError, mySelectedTestProxy);
}
Also used : SMTestProxy(com.intellij.execution.testframework.sm.runner.SMTestProxy)

Example 28 with SMTestProxy

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

the class SMTRunnerUIActionsHandlerTest method testSelectFirstDefect_Priority_Pending.

public void testSelectFirstDefect_Priority_Pending() {
    // Priority: error -> failure
    TestConsoleProperties.SELECT_FIRST_DEFECT.set(myProperties, true);
    mySuite.setStarted();
    final SMTestProxy testsSuite = createSuiteProxy("my suite", mySuite);
    testsSuite.setStarted();
    // pending test
    final SMTestProxy testPending = createTestProxy("testPending", testsSuite);
    testPending.setStarted();
    myUIActionsHandler.onTestNodeAdded(myResultsViewer, testPending);
    testPending.setTestIgnored("", "");
    // finish suite
    testsSuite.setFinished();
    assertNull(mySelectedTestProxy);
    //testing finished
    mySuite.setFinished();
    assertNull(mySelectedTestProxy);
    myUIActionsHandler.onTestingFinished(myResultsViewer);
    // pending tests shouldn't be considered as errors/failures
    assertNull(mySelectedTestProxy);
}
Also used : SMTestProxy(com.intellij.execution.testframework.sm.runner.SMTestProxy)

Example 29 with SMTestProxy

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

the class SMTRunnerUIActionsHandlerTest method testSelectFirstDefect_Priority_Failure.

public void testSelectFirstDefect_Priority_Failure() {
    // Priority: error -> failure
    TestConsoleProperties.SELECT_FIRST_DEFECT.set(myProperties, true);
    mySuite.setStarted();
    final SMTestProxy testsSuite = createSuiteProxy("my suite", mySuite);
    testsSuite.setStarted();
    // pending test
    final SMTestProxy testPending = createTestProxy("testPending", testsSuite);
    testPending.setStarted();
    myUIActionsHandler.onTestNodeAdded(myResultsViewer, testPending);
    testPending.setTestIgnored("", "");
    //failed test
    final SMTestProxy testFailed = createTestProxy("testFailed", testsSuite);
    testFailed.setStarted();
    myUIActionsHandler.onTestNodeAdded(myResultsViewer, testFailed);
    testFailed.setTestFailed("", "", false);
    // Second failed test just to check that first failed will be selected
    final SMTestProxy testFailed2 = createTestProxy("testFailed2", testsSuite);
    testFailed2.setStarted();
    myUIActionsHandler.onTestNodeAdded(myResultsViewer, testFailed2);
    testFailed2.setTestFailed("", "", false);
    // finish suite
    testsSuite.setFinished();
    assertNull(mySelectedTestProxy);
    //testing finished
    mySuite.setFinished();
    assertNull(mySelectedTestProxy);
    myUIActionsHandler.onTestingFinished(myResultsViewer);
    assertEquals(testFailed, mySelectedTestProxy);
}
Also used : SMTestProxy(com.intellij.execution.testframework.sm.runner.SMTestProxy)

Example 30 with SMTestProxy

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

the class SMTestRunnerResultsFormTest method testCustomProgress_Failure.

public void testCustomProgress_Failure() {
    myResultsViewer.onCustomProgressTestsCategory("foo", 4);
    final SMTestProxy test1 = createTestProxy("some_test1", myTestsRootNode);
    myResultsViewer.onTestStarted(test1);
    myResultsViewer.onCustomProgressTestStarted();
    myResultsViewer.onTestFailed(test1);
    assertEquals(0, myResultsViewer.getFailedTestCount());
    myResultsViewer.onCustomProgressTestFailed();
    assertEquals(1, myResultsViewer.getFailedTestCount());
    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