本文整理汇总了Java中com.intellij.execution.testframework.sm.runner.GeneralTestEventsProcessor.onTestStarted方法的典型用法代码示例。如果您正苦于以下问题:Java GeneralTestEventsProcessor.onTestStarted方法的具体用法?Java GeneralTestEventsProcessor.onTestStarted怎么用?Java GeneralTestEventsProcessor.onTestStarted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.execution.testframework.sm.runner.GeneralTestEventsProcessor
的用法示例。
在下文中一共展示了GeneralTestEventsProcessor.onTestStarted方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: reportTargetWithoutOutputFiles
import com.intellij.execution.testframework.sm.runner.GeneralTestEventsProcessor; //导入方法依赖的package包/类
/**
* If there are no output files, the test may have failed to build, or timed out. Provide a
* suitable message in the test UI.
*/
private void reportTargetWithoutOutputFiles(Label label, TestStatus status) {
if (status == TestStatus.PASSED) {
// Empty test targets do not produce output XML, yet technically pass. Ignore them.
return;
}
GeneralTestEventsProcessor processor = getProcessor();
TestSuiteStarted suiteStarted = new TestSuiteStarted(label.toString());
processor.onSuiteStarted(new TestSuiteStartedEvent(suiteStarted, /*locationUrl=*/ null));
String targetName = label.targetName().toString();
processor.onTestStarted(new TestStartedEvent(targetName, /*locationUrl=*/ null));
processor.onTestFailure(
getTestFailedEvent(
targetName,
STATUS_EXPLANATIONS.get(status) + " See console output for details",
/*content=*/ null,
/*duration=*/ 0));
processor.onTestFinished(new TestFinishedEvent(targetName, /*duration=*/ 0L));
processor.onSuiteFinished(new TestSuiteFinishedEvent(label.toString()));
}
示例2: consumeTestResultsAvailable
import com.intellij.execution.testframework.sm.runner.GeneralTestEventsProcessor; //导入方法依赖的package包/类
@Override
public void consumeTestResultsAvailable(long timestamp, TestResults testResults) {
final GeneralTestEventsProcessor processor = getProcessor();
if (processor == null) {
return;
}
for (TestCaseSummary suite : testResults.getTestCases()) {
if (suite.getTestResults().isEmpty()) {
continue;
}
processor.onSuiteStarted(new TestSuiteStartedEvent(suite.getTestCaseName(), null));
for (TestResultsSummary test : suite.getTestResults()) {
final String testName = test.getTestName();
String locationUrl = String.format("java:test://%s.%s", test.getTestCaseName(), testName);
processor.onTestStarted(new TestStartedEvent(testName, locationUrl));
final String stdOut = test.getStdOut();
if (stdOut != null) {
processor.onTestOutput(new TestOutputEvent(testName, stdOut, true));
}
final String stdErr = test.getStdErr();
if (stdErr != null) {
processor.onTestOutput(new TestOutputEvent(testName, stdErr, false));
}
if (test.getType() == ResultType.FAILURE) {
processor.onTestFailure(
new TestFailedEvent(testName, "", test.getStacktrace(), true, null, null));
}
processor.onTestFinished(new TestFinishedEvent(testName, test.getTime()));
}
processor.onSuiteFinished(new TestSuiteFinishedEvent(suite.getTestCaseName()));
}
}
示例3: handle
import com.intellij.execution.testframework.sm.runner.GeneralTestEventsProcessor; //导入方法依赖的package包/类
@NotNull
@Override
public JsonResponse handle(@NotNull UnityTestStatePostRequest request)
{
UUID uuid = UUID.fromString(request.uuid);
Unity3dTestSession session = Unity3dTestSessionManager.getInstance().findSession(uuid);
if(session == null)
{
return JsonResponse.asError("no session");
}
GeneralTestEventsProcessor processor = session.getProcessor();
ProcessHandler processHandler = session.getProcessHandler();
String name = request.name;
switch(request.type)
{
case TestStarted:
processor.onTestStarted(new TestStartedEvent(name, null));
break;
case TestIgnored:
processor.onTestIgnored(new TestIgnoredEvent(name, StringUtil.notNullize(request.message), request.stackTrace));
break;
case TestFailed:
processor.onTestFailure(new TestFailedEvent(name, StringUtil.notNullize(request.message), request.stackTrace, false, null, null));
break;
case TestOutput:
boolean stdOut = "Log".equals(request.messageType) || "Warning".equals(request.messageType);
StringBuilder builder = new StringBuilder(request.message);
if(!stdOut)
{
builder.append("\n");
String[] strings = StringUtil.splitByLines(request.stackTrace);
for(String line : strings)
{
builder.append(" at ").append(line).append("\n");
}
}
processor.onTestOutput(new TestOutputEvent(name, builder.toString(), stdOut));
break;
case TestFinished:
long time = (long) (request.time * 1000L);
processor.onTestFinished(new TestFinishedEvent(name, time));
break;
case SuiteStarted:
processor.onSuiteStarted(new TestSuiteStartedEvent(name, null));
break;
case SuiteFinished:
processor.onSuiteFinished(new TestSuiteFinishedEvent(name));
break;
case RunFinished:
processor.onFinishTesting();
processHandler.destroyProcess();
break;
}
return JsonResponse.asSuccess(null);
}