• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java SMTestRunnerConnectionUtil类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil的典型用法代码示例。如果您正苦于以下问题:Java SMTestRunnerConnectionUtil类的具体用法?Java SMTestRunnerConnectionUtil怎么用?Java SMTestRunnerConnectionUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SMTestRunnerConnectionUtil类属于com.intellij.execution.testframework.sm包,在下文中一共展示了SMTestRunnerConnectionUtil类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getConsoleView

import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; //导入依赖的package包/类
public static SMTRunnerConsoleView getConsoleView(
    Project project,
    BlazeCommandRunConfiguration configuration,
    Executor executor,
    BlazeTestUiSession testUiSession) {
  SMTRunnerConsoleProperties properties =
      new BlazeTestConsoleProperties(configuration, executor, testUiSession);
  SMTRunnerConsoleView console =
      (SMTRunnerConsoleView)
          SMTestRunnerConnectionUtil.createConsole(BLAZE_FRAMEWORK, properties);
  Disposer.register(project, console);
  console
      .getResultsViewer()
      .getTreeView()
      .getSelectionModel()
      .setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
  return console;
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:19,代码来源:SmRunnerUtils.java


示例2: execute

import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; //导入依赖的package包/类
@NotNull
@Override
public ExecutionResult execute(@NotNull Executor executor, @NotNull ProgramRunner runner) throws ExecutionException {
    if (GaugeVersion.isGreaterOrEqual(GaugeRunConfiguration.TEST_RUNNER_SUPPORT_VERSION, false)
            && GaugeSettingsService.getSettings().useIntelliJTestRunner()) {
        ProcessHandler handler = startProcess();
        GaugeConsoleProperties properties = new GaugeConsoleProperties(config, "Gauge", executor, handler);
        ConsoleView console = SMTestRunnerConnectionUtil.createAndAttachConsole("Gauge", handler, properties);
        DefaultExecutionResult result = new DefaultExecutionResult(console, handler, createActions(console, handler));
        if (ActionManager.getInstance().getAction("RerunFailedTests") != null) {
            AbstractRerunFailedTestsAction action = properties.createRerunFailedTestsAction(console);
            if (action != null) {
                action.setModelProvider(((SMTRunnerConsoleView) console)::getResultsViewer);
                result.setRestartActions(action);
            }
        }
        return result;
    }
    return super.execute(executor, runner);
}
 
开发者ID:getgauge,项目名称:Intellij-Plugin,代码行数:21,代码来源:GaugeCommandLineState.java


示例3: showMavenToolWindow

import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; //导入依赖的package包/类
public void showMavenToolWindow() {
    ConfigurationType configurationType = new JUnitConfigurationType();
    ConfigurationFactory configurationFactory = new ConfigurationFactoryEx<JUnitConfiguration>(configurationType) {
        @NotNull
        @Override
        public RunConfiguration createTemplateConfiguration(@NotNull Project project) {
            return new JUnitConfiguration(project.getName(), project, this);
        }
    };
    JUnitConfiguration configuration = new JUnitConfiguration(project.getName(), project, configurationFactory);
    Executor executor = new DefaultRunExecutor();
    ProcessHandler processHandler = new NopProcessHandler();
    TestConsoleProperties consoleProperties = new MavenTestConsoleProperties(mavenProject, project, executor, configuration, processHandler);
    BaseTestsOutputConsoleView consoleView;
    try {
        consoleView = SMTestRunnerConnectionUtil.createAndAttachConsole(TOOL_WINDOW_ID, processHandler, consoleProperties);
    } catch (ExecutionException e) {
        throw new RuntimeException(e);
    }
    showInToolWindow(consoleView, mavenProject.getFinalName());
    processHandler.startNotify();
}
 
开发者ID:destin,项目名称:maven-test-support-plugin,代码行数:23,代码来源:MavenToolWindow.java


示例4: createConsole

import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; //导入依赖的package包/类
public static ConsoleView createConsole(Project project, ProcessHandler processHandler, ExecutionEnvironment executionEnvironment, TesterTestLocator locationProvider) {
    TesterRunConfiguration profile = (TesterRunConfiguration) executionEnvironment.getRunProfile();

    TesterConsoleProperties properties = new TesterConsoleProperties(profile, executionEnvironment.getExecutor(), locationProvider);
    properties.addStackTraceFilter(new XdebugCallStackFilter(project, locationProvider.getPathMapper()));

    BaseTestsOutputConsoleView testsOutputConsoleView = SMTestRunnerConnectionUtil.createConsole("Nette Tester", properties);
    testsOutputConsoleView.addMessageFilter(new TesterStackTraceFilter(project, locationProvider.getPathMapper()));
    testsOutputConsoleView.attachToProcess(processHandler);
    Disposer.register(project, testsOutputConsoleView);
    return testsOutputConsoleView;
}
 
开发者ID:jiripudil,项目名称:intellij-nette-tester,代码行数:13,代码来源:TesterExecutionUtil.java


示例5: onTestIgnored

import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; //导入依赖的package包/类
public void onTestIgnored(@NotNull final TestIgnoredEvent testIgnoredEvent) {
   addToInvokeLater(new Runnable() {
    public void run() {
      final String testName = ObjectUtils.assertNotNull(testIgnoredEvent.getName());
      String ignoreComment = testIgnoredEvent.getIgnoreComment();
      final String stackTrace = testIgnoredEvent.getStacktrace();
      final String fullTestName = getFullTestName(testName);
      SMTestProxy testProxy = getProxyByFullTestName(fullTestName);
      if (testProxy == null) {
        final boolean debugMode = SMTestRunnerConnectionUtil.isInDebugMode();
        logProblem("Test wasn't started! " +
                   "TestIgnored event: name = {" + testName + "}, " +
                   "message = {" + ignoreComment + "}. " +
                   cannotFindFullTestNameMsg(fullTestName));
        if (debugMode) {
          return;
        } else {
          // try to fix
          // 1. report test opened
          onTestStarted(new TestStartedEvent(testName, null));

          // 2. report failure
          testProxy = getProxyByFullTestName(fullTestName);
        }

      }
      if (testProxy == null) {
        return;
      }
      testProxy.setTestIgnored(ignoreComment, stackTrace);

      // fire event
      fireOnTestIgnored(testProxy);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:GeneralToSMTRunnerEventsConvertor.java


示例6: execute

import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; //导入依赖的package包/类
@Nullable
@Override
public ExecutionResult execute(Executor executor, @NotNull ProgramRunner runner) throws ExecutionException {
  final MyEmptyProcessHandler handler = new MyEmptyProcessHandler();
  final SMTRunnerConsoleProperties properties = myRunProfile.getProperties();
  RunProfile configuration;
  final String frameworkName;
  if (properties != null) {
    configuration = properties.getConfiguration();
    frameworkName = properties.getTestFrameworkName();
  }
  else {
    configuration = myRunProfile;
    frameworkName = "Import Test Results";
  }
  final ImportedTestConsoleProperties consoleProperties = new ImportedTestConsoleProperties(properties, myFile, handler, myRunProfile.getProject(),
                                                                                            configuration, frameworkName, executor);
  final BaseTestsOutputConsoleView console = SMTestRunnerConnectionUtil.createConsole(consoleProperties.getTestFrameworkName(), 
                                                                                      consoleProperties);
  final JComponent component = console.getComponent();
  AbstractRerunFailedTestsAction rerunFailedTestsAction = null;
  if (component instanceof TestFrameworkRunningModel) {
    rerunFailedTestsAction = consoleProperties.createRerunFailedTestsAction(console);
    if (rerunFailedTestsAction != null) {
      rerunFailedTestsAction.setModelProvider(new Getter<TestFrameworkRunningModel>() {
        @Override
        public TestFrameworkRunningModel get() {
          return (TestFrameworkRunningModel)component;
        }
      });
    }
  }
  
  console.attachToProcess(handler);
  final DefaultExecutionResult result = new DefaultExecutionResult(console, handler);
  if (rerunFailedTestsAction != null) {
    result.setRestartActions(rerunFailedTestsAction);
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:ImportedTestRunnableState.java


示例7: attachConsole

import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; //导入依赖的package包/类
@NotNull
@Override
protected ConsoleView attachConsole(AndroidRunningState state, Executor executor) throws ExecutionException {
  AndroidTestConsoleProperties properties = new AndroidTestConsoleProperties(this, executor);
  ConsoleView consoleView = SMTestRunnerConnectionUtil.createAndAttachConsole("Android", state.getProcessHandler(), properties);
  Disposer.register(state.getFacet().getModule().getProject(), consoleView);
  return consoleView;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:AndroidTestRunConfiguration.java


示例8: attachExecutionConsole

import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; //导入依赖的package包/类
@NotNull
@Override
public ExecutionConsole attachExecutionConsole(@NotNull final ExternalSystemTask task,
                                               @NotNull final Project project,
                                               @NotNull final ExternalSystemRunConfiguration configuration,
                                               @NotNull final Executor executor,
                                               @NotNull final ExecutionEnvironment env,
                                               @NotNull final ProcessHandler processHandler) throws ExecutionException {
  final GradleConsoleProperties properties = new GradleConsoleProperties(configuration, executor);
  myExecutionConsole = (SMTRunnerConsoleView)SMTestRunnerConnectionUtil.createAndAttachConsole(
    configuration.getSettings().getExternalSystemId().getReadableName(), processHandler, properties);

  TestTreeRenderer originalRenderer =
    ObjectUtils.tryCast(myExecutionConsole.getResultsViewer().getTreeView().getCellRenderer(), TestTreeRenderer.class);
  if (originalRenderer != null) {
    originalRenderer.setAdditionalRootFormatter(new SMRootTestProxyFormatter() {
      @Override
      public void format(@NotNull SMTestProxy.SMRootTestProxy testProxy, @NotNull TestTreeRenderer renderer) {
        final TestStateInfo.Magnitude magnitude = testProxy.getMagnitudeInfo();
        if (magnitude == TestStateInfo.Magnitude.RUNNING_INDEX) {
          renderer.clear();
          renderer.append(GradleBundle.message(
                            "gradle.test.runner.ui.tests.tree.presentation.labels.waiting.tests"),
                          SimpleTextAttributes.REGULAR_ATTRIBUTES
          );
        }
        else if (!testProxy.isInProgress() && testProxy.isEmptySuite()) {
          renderer.clear();
          renderer.append(GradleBundle.message(
                            "gradle.test.runner.ui.tests.tree.presentation.labels.no.tests.were.found"),
                          SimpleTextAttributes.REGULAR_ATTRIBUTES
          );
        }
      }
    });
  }
  return myExecutionConsole;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:GradleTestsExecutionConsoleManager.java


示例9: getStockConsoleProvider

import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; //导入依赖的package包/类
private ConsoleProvider getStockConsoleProvider() {
  return (parent, handler, executor) -> {
    AndroidTestConsoleProperties properties =
        new AndroidTestConsoleProperties(runConfiguration, executor);
    ConsoleView consoleView =
        SMTestRunnerConnectionUtil.createAndAttachConsole("Android", handler, properties);
    Disposer.register(parent, consoleView);
    return consoleView;
  };
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:11,代码来源:AndroidTestConsoleProvider.java


示例10: onTestStarted

import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; //导入依赖的package包/类
public void onTestStarted(@NotNull final TestStartedEvent testStartedEvent) {
  addToInvokeLater(new Runnable() {
    public void run() {
      final String testName = testStartedEvent.getName();
      final String locationUrl = testStartedEvent.getLocationUrl();
      final String fullName = getFullTestName(testName);

      if (myRunningTestsFullNameToProxy.containsKey(fullName)) {
        //Duplicated event
        logProblem("Test [" + fullName + "] has been already started");

        if (SMTestRunnerConnectionUtil.isInDebugMode()) {
          return;
        }
      }

      final SMTestProxy parentSuite = getCurrentSuite();

      // creates test
      final SMTestProxy testProxy = new SMTestProxy(testName, false, locationUrl);
      if (myLocator != null) {
        testProxy.setLocator(myLocator);
      }
      parentSuite.addChild(testProxy);
      // adds to running tests map
      myRunningTestsFullNameToProxy.put(fullName, testProxy);

      //Progress started
      testProxy.setStarted();

      //fire events
      fireOnTestStarted(testProxy);
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:36,代码来源:GeneralToSMTRunnerEventsConvertor.java


示例11: onTestIgnored

import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; //导入依赖的package包/类
public void onTestIgnored(@NotNull final TestIgnoredEvent testIgnoredEvent) {
   addToInvokeLater(new Runnable() {
    public void run() {
      final String testName = ObjectUtils.assertNotNull(testIgnoredEvent.getName());
      final String ignoreComment = testIgnoredEvent.getIgnoreComment();
      final String stackTrace = testIgnoredEvent.getStacktrace();
      final String fullTestName = getFullTestName(testName);
      SMTestProxy testProxy = getProxyByFullTestName(fullTestName);
      if (testProxy == null) {
        final boolean debugMode = SMTestRunnerConnectionUtil.isInDebugMode();
        logProblem("Test wasn't started! " +
                   "TestIgnored event: name = {" + testName + "}, " +
                   "message = {" + ignoreComment + "}. " +
                   cannotFindFullTestNameMsg(fullTestName));
        if (debugMode) {
          return;
        } else {
          // try to fix
          // 1. report test opened
          onTestStarted(new TestStartedEvent(testName, null));

          // 2. report failure
          testProxy = getProxyByFullTestName(fullTestName);
        }

      }
      if (testProxy == null) {
        return;
      }
      testProxy.setTestIgnored(ignoreComment, stackTrace);

      // fire event
      fireOnTestIgnored(testProxy);
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:37,代码来源:GeneralToSMTRunnerEventsConvertor.java


示例12: useSmRunner

import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; //导入依赖的package包/类
private ExecutionResult useSmRunner(Executor executor, JUnitProcessHandler handler) {
  TestConsoleProperties testConsoleProperties = new SMTRunnerConsoleProperties(
    new RuntimeConfigurationProducer.DelegatingRuntimeConfiguration<JUnitConfiguration>(
      (JUnitConfiguration)myEnvironment.getRunProfile()),
    JUNIT_TEST_FRAMEWORK_NAME,
    executor
  );

  testConsoleProperties.setIfUndefined(TestConsoleProperties.HIDE_PASSED_TESTS, false);

  BaseTestsOutputConsoleView smtConsoleView = SMTestRunnerConnectionUtil.createConsoleWithCustomLocator(
    JUNIT_TEST_FRAMEWORK_NAME,
    testConsoleProperties,
    myEnvironment, null);


  Disposer.register(myProject, smtConsoleView);

  final ConsoleView consoleView = smtConsoleView;
  consoleView.attachToProcess(handler);

  final RerunFailedTestsAction rerunFailedTestsAction = new RerunFailedTestsAction(consoleView);
  rerunFailedTestsAction.init(testConsoleProperties, myEnvironment);
  rerunFailedTestsAction.setModelProvider(new Getter<TestFrameworkRunningModel>() {
    @Override
    public TestFrameworkRunningModel get() {
      return ((SMTRunnerConsoleView)consoleView).getResultsViewer();
    }
  });

  final DefaultExecutionResult result = new DefaultExecutionResult(consoleView, handler);
  result.setRestartActions(rerunFailedTestsAction);
  return result;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:35,代码来源:TestObject.java


示例13: execute

import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; //导入依赖的package包/类
@Nullable
@Override
public ExecutionResult execute(Executor executor, @NotNull ProgramRunner runner)
    throws ExecutionException {
  final ProcessHandler processHandler = runBuildCommand(executor);
  final TestConsoleProperties properties =
      new BuckTestConsoleProperties(
          processHandler, mProject, mConfiguration, "Buck test", executor);
  final ConsoleView console =
      SMTestRunnerConnectionUtil.createAndAttachConsole("buck test", processHandler, properties);
  return new DefaultExecutionResult(console, processHandler, AnAction.EMPTY_ARRAY);
}
 
开发者ID:facebook,项目名称:buck,代码行数:13,代码来源:TestExecutionState.java


示例14: createConsoleWithCustomLocator

import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; //导入依赖的package包/类
public static SMTRunnerConsoleView createConsoleWithCustomLocator(@Nonnull final String testFrameworkName,
                                                                  @Nonnull final TestConsoleProperties consoleProperties,
                                                                  ExecutionEnvironment environment,
                                                                  @javax.annotation.Nullable final TestLocationProvider locator,
                                                                  final ThriftTestHandlerFactory factory,
                                                                  @javax.annotation.Nullable final TestProxyFilterProvider filterProvider) {
  String splitterPropertyName = SMTestRunnerConnectionUtil.getSplitterPropertyName(testFrameworkName);
  SMTRunnerConsoleView consoleView = new SMTRunnerConsoleView(consoleProperties, splitterPropertyName);
  initConsoleView(consoleView, testFrameworkName, locator, factory, filterProvider);
  return consoleView;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:12,代码来源:ThriftTestExecutionUtil.java


示例15: onTestIgnored

import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; //导入依赖的package包/类
@Override
public void onTestIgnored(@Nonnull final TestIgnoredEvent testIgnoredEvent) {
  addToInvokeLater(() -> {
    final String testName = testIgnoredEvent.getName();
    if (testName == null) {
      logProblem("TestIgnored event: no name");
    }
    String ignoreComment = testIgnoredEvent.getIgnoreComment();
    final String stackTrace = testIgnoredEvent.getStacktrace();
    final String fullTestName = getFullTestName(testName);
    SMTestProxy testProxy = getProxyByFullTestName(fullTestName);
    if (testProxy == null) {
      final boolean debugMode = SMTestRunnerConnectionUtil.isInDebugMode();
      logProblem("Test wasn't started! " +
                 "TestIgnored event: name = {" + testName + "}, " +
                 "message = {" + ignoreComment + "}. " +
                 cannotFindFullTestNameMsg(fullTestName));
      if (debugMode) {
        return;
      } else {
        // try to fix
        // 1. report test opened
        onTestStarted(new TestStartedEvent(testName, null));

        // 2. report failure
        testProxy = getProxyByFullTestName(fullTestName);
      }

    }
    if (testProxy == null) {
      return;
    }
    testProxy.setTestIgnored(ignoreComment, stackTrace);

    // fire event
    fireOnTestIgnored(testProxy);
  });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:39,代码来源:GeneralToSMTRunnerEventsConvertor.java


示例16: execute

import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; //导入依赖的package包/类
@Nullable
@Override
public ExecutionResult execute(Executor executor, @Nonnull ProgramRunner runner) throws ExecutionException {
  final MyEmptyProcessHandler handler = new MyEmptyProcessHandler();
  final SMTRunnerConsoleProperties properties = myRunProfile.getProperties();
  RunProfile configuration;
  final String frameworkName;
  if (properties != null) {
    configuration = properties.getConfiguration();
    frameworkName = properties.getTestFrameworkName();
  }
  else {
    configuration = myRunProfile;
    frameworkName = "Import Test Results";
  }
  final ImportedTestConsoleProperties consoleProperties = new ImportedTestConsoleProperties(properties, myFile, handler, myRunProfile.getProject(),
                                                                                            configuration, frameworkName, executor);
  final BaseTestsOutputConsoleView console = SMTestRunnerConnectionUtil.createConsole(consoleProperties.getTestFrameworkName(),
                                                                                      consoleProperties);
  final JComponent component = console.getComponent();
  AbstractRerunFailedTestsAction rerunFailedTestsAction = null;
  if (component instanceof TestFrameworkRunningModel) {
    rerunFailedTestsAction = consoleProperties.createRerunFailedTestsAction(console);
    if (rerunFailedTestsAction != null) {
      rerunFailedTestsAction.setModelProvider(new Getter<TestFrameworkRunningModel>() {
        @Override
        public TestFrameworkRunningModel get() {
          return (TestFrameworkRunningModel)component;
        }
      });
    }
  }

  console.attachToProcess(handler);
  final DefaultExecutionResult result = new DefaultExecutionResult(console, handler);
  if (rerunFailedTestsAction != null) {
    result.setRestartActions(rerunFailedTestsAction);
  }
  return result;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:41,代码来源:ImportedTestRunnableState.java


示例17: onTestStarted

import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; //导入依赖的package包/类
public void onTestStarted(@NotNull final TestStartedEvent testStartedEvent) {
  addToInvokeLater(new Runnable() {
    public void run() {
      final String testName = testStartedEvent.getName();
      final String locationUrl = testStartedEvent.getLocationUrl();
      final boolean isConfig = testStartedEvent.isConfig();
      final String fullName = getFullTestName(testName);

      if (myRunningTestsFullNameToProxy.containsKey(fullName)) {
        //Duplicated event
        logProblem("Test [" + fullName + "] has been already started");
        if (SMTestRunnerConnectionUtil.isInDebugMode()) {
          return;
        }
      }

      SMTestProxy parentSuite = getCurrentSuite();
      SMTestProxy testProxy = findChildByName(parentSuite, fullName);
      if (testProxy == null) {
        // creates test
        testProxy = new SMTestProxy(testName, false, locationUrl);
        testProxy.setConfig(isConfig);

        if (myLocator != null) {
          testProxy.setLocator(myLocator);
        }

        parentSuite.addChild(testProxy);

        if (myTreeBuildBeforeStart && myGetChildren) {
          for (SMTestProxy proxy : parentSuite.getChildren()) {
            if (!proxy.isFinal()) {
              myCurrentChildren.add(proxy);
            }
          }
          myGetChildren = false;
        }
      }

      // adds to running tests map
      myRunningTestsFullNameToProxy.put(fullName, testProxy);

      //Progress started
      testProxy.setStarted();

      //fire events
      fireOnTestStarted(testProxy);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:51,代码来源:GeneralToSMTRunnerEventsConvertor.java


示例18: onTestFailure

import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; //导入依赖的package包/类
public void onTestFailure(@NotNull final TestFailedEvent testFailedEvent) {
  addToInvokeLater(new Runnable() {
    public void run() {
      final String testName = testFailedEvent.getName();
      if (testName == null) {
        logProblem("No test name specified in " + testFailedEvent);
        return;
      }
      final String localizedMessage = testFailedEvent.getLocalizedFailureMessage();
      final String stackTrace = testFailedEvent.getStacktrace();
      final boolean isTestError = testFailedEvent.isTestError();
      final String comparisionFailureActualText = testFailedEvent.getComparisonFailureActualText();
      final String comparisionFailureExpectedText = testFailedEvent.getComparisonFailureExpectedText();
      final boolean inDebugMode = SMTestRunnerConnectionUtil.isInDebugMode();

      final String fullTestName = getFullTestName(testName);
      SMTestProxy testProxy = getProxyByFullTestName(fullTestName);
      if (testProxy == null) {
        logProblem("Test wasn't started! TestFailure event: name = {" + testName + "}" +
                           ", message = {" + localizedMessage + "}" +
                           ", stackTrace = {" + stackTrace + "}. " +
                           cannotFindFullTestNameMsg(fullTestName));
        if (inDebugMode) {
          return;
        }
        else {
          // if hasn't been already reported
          // 1. report
          onTestStarted(new TestStartedEvent(testName, null));
          // 2. add failure
          testProxy = getProxyByFullTestName(fullTestName);
        }
      }

      if (testProxy == null) {
        return;
      }

      if (comparisionFailureActualText != null && comparisionFailureExpectedText != null) {
        testProxy.setTestComparisonFailed(localizedMessage, stackTrace,
                                          comparisionFailureActualText, comparisionFailureExpectedText, 
                                          testFailedEvent.getFilePath(), testFailedEvent.getActualFilePath());
      }
      else if (comparisionFailureActualText == null && comparisionFailureExpectedText == null) {
        testProxy.setTestFailed(localizedMessage, stackTrace, isTestError);
      }
      else {
        logProblem("Comparison failure actual and expected texts should be both null or not null.\n"
                   + "Expected:\n"
                   + comparisionFailureExpectedText + "\n"
                   + "Actual:\n"
                   + comparisionFailureActualText);
      }

      // fire event
      fireOnTestFailed(testProxy);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:60,代码来源:GeneralToSMTRunnerEventsConvertor.java


示例19: logProblem

import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; //导入依赖的package包/类
public static void logProblem(final Logger log, final String msg, final String testFrameworkName) {
  logProblem(log, msg, SMTestRunnerConnectionUtil.isInDebugMode(), testFrameworkName);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:GeneralTestEventsProcessor.java


示例20: popSuite

import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; //导入依赖的package包/类
/**
 * Pop element form stack and checks consistency
 * @param suiteName Predictable name of top suite in stack. May be null if 
 */
@Nullable
public SMTestProxy popSuite(final String suiteName) throws EmptyStackException {
  if (myStack.isEmpty()) {
    if (SMTestRunnerConnectionUtil.isInDebugMode()) {
      LOG.error(
        "Pop error: Tests/suites stack is empty. Test runner tried to close test suite " +
        "which has been already closed or wasn't started at all. Unexpected suite name [" +
        suiteName + "]");
    }
    return null;
  }
  final SMTestProxy topSuite = myStack.peek();
  if (suiteName == null) {
    String msg = "Pop error: undefined suite name. Rest of stack: " + getSuitePathPresentation();
    GeneralTestEventsProcessor.logProblem(LOG, msg, true, myTestFrameworkName);
    return null;
  }

  if (!suiteName.equals(topSuite.getName())) {
    if (SMTestRunnerConnectionUtil.isInDebugMode()) {
      LOG.error("Pop error: Unexpected closing suite. Expected [" + suiteName + "] but [" + topSuite.getName() +
                "] was found. Rest of stack: " + getSuitePathPresentation());
    } else {
      // let's try to switch to consistent state
      // 1. If expected suite name is somewhere in stack - let's find it and drop rest head of the stack
      SMTestProxy expectedProxy = null;
      for (SMTestProxy candidateProxy : myStack) {
        if (suiteName.equals(candidateProxy.getName())) {
          expectedProxy = candidateProxy;
          break;
        }
      }
      if (expectedProxy != null) {
        // drop all tests above it
        SMTestProxy proxy = topSuite;
        while (proxy != expectedProxy) {
          proxy = myStack.pop();
        }

        return expectedProxy;
      } else {
        // 2. if expected suite wasn't found let's skip it and return null
        return null;
      }
    }
    return null;
  } else {
    myStack.pop();
  }

  return topSuite;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:57,代码来源:TestSuiteStack.java



注:本文中的com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DaggerMockRule类代码示例发布时间:2022-05-22
下一篇:
Java PostDeleteEvent类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap