allow to disable "Testing started at <TIME>..." printing on test run

This commit is contained in:
Sergey Simonchik
2014-01-17 16:13:45 +04:00
parent c2834c0939
commit 13b4260497
3 changed files with 34 additions and 14 deletions
@@ -45,27 +45,44 @@ import org.jetbrains.annotations.Nullable;
public class SMTRunnerConsoleProperties extends TestConsoleProperties implements SMStacktraceParser {
private final RunConfiguration myConfiguration;
protected final CompositeFilter myCustomFilter;
private final boolean myPrintTestingStartedTime;
/**
* @param config
* @param testFrameworkName Prefix for storage which keeps runner settings. E.g. "RubyTestUnit"
* @param executor
*/
public SMTRunnerConsoleProperties(@NotNull final RunConfiguration config,
@NotNull final String testFrameworkName,
@NotNull final Executor executor)
{
public SMTRunnerConsoleProperties(@NotNull RunConfiguration config,
@NotNull String testFrameworkName,
@NotNull Executor executor) {
this(config, testFrameworkName, executor, true);
}
/**
* @param config
* @param testFrameworkName Prefix for storage which keeps runner settings. E.g. "RubyTestUnit"
* @param executor
*/
public SMTRunnerConsoleProperties(@NotNull RunConfiguration config,
@NotNull String testFrameworkName,
@NotNull Executor executor,
boolean printTestingStartedTime) {
super(new Storage.PropertiesComponentStorage(testFrameworkName + "Support.", PropertiesComponent.getInstance()),
config.getProject(),
executor);
myConfiguration = config;
myCustomFilter = new CompositeFilter(config.getProject());
myPrintTestingStartedTime = printTestingStartedTime;
}
public RunConfiguration getConfiguration() {
return myConfiguration;
}
public boolean isPrintTestingStartedTime() {
return myPrintTestingStartedTime;
}
@Override
public Navigatable getErrorNavigatable(@NotNull final Project project, final @NotNull String stacktrace) {
if (myCustomFilter.isEmpty()) {
@@ -19,10 +19,7 @@ import com.intellij.execution.configurations.RunConfiguration;
import com.intellij.execution.runners.ExecutionEnvironment;
import com.intellij.execution.testframework.*;
import com.intellij.execution.testframework.sm.SMRunnerUtil;
import com.intellij.execution.testframework.sm.runner.SMTRunnerEventsListener;
import com.intellij.execution.testframework.sm.runner.SMTRunnerTreeBuilder;
import com.intellij.execution.testframework.sm.runner.SMTRunnerTreeStructure;
import com.intellij.execution.testframework.sm.runner.SMTestProxy;
import com.intellij.execution.testframework.sm.runner.*;
import com.intellij.execution.testframework.sm.runner.ui.statistics.StatisticsPanel;
import com.intellij.execution.testframework.ui.AbstractTestTreeBuilder;
import com.intellij.execution.testframework.ui.TestResultsPanel;
@@ -217,9 +214,15 @@ public class SMTestRunnerResultsForm extends TestResultsPanel
selectAndNotify(myTestsRootNode);
myStartTime = System.currentTimeMillis();
myTestsRootNode.addSystemOutput("Testing started at "
+ DateFormatUtil.formatTime(myStartTime)
+ " ...\n");
boolean printTestingStartedTime = true;
if (myConsoleProperties instanceof SMTRunnerConsoleProperties) {
printTestingStartedTime = ((SMTRunnerConsoleProperties) myConsoleProperties).isPrintTestingStartedTime();
}
if (printTestingStartedTime) {
myTestsRootNode.addSystemOutput("Testing started at "
+ DateFormatUtil.formatTime(myStartTime)
+ " ...\n");
}
updateStatusLabel(false);
@@ -398,7 +398,7 @@ public class SMTRunnerConsoleTest extends BaseSMTRunnerTestCase {
final MockPrinter mockPrinter1 = new MockPrinter(true);
mockPrinter1.onNewAvailable(myTest1);
assertAllOutputs(mockPrinter1, "stdout1 ", "stderr1 ", "\nignored msg\n");
assertAllOutputs(mockPrinter1, "stdout1 ", "stderr1 ", "\nignored msg");
//other output order
final SMTestProxy myTest2 = startTestWithPrinter("my_test2");
@@ -406,10 +406,10 @@ public class SMTRunnerConsoleTest extends BaseSMTRunnerTestCase {
myEventsProcessor.onTestOutput(new TestOutputEvent("my_test2", "stderr1 ", false));
myEventsProcessor.onTestIgnored(new TestIgnoredEvent("my_test2", "ignored msg", null));
assertAllOutputs(myMockResettablePrinter, "stdout1 ", "stderr1 ", "\nignored msg\n");
assertAllOutputs(myMockResettablePrinter, "stdout1 ", "stderr1 ", "\nignored msg");
final MockPrinter mockPrinter2 = new MockPrinter(true);
mockPrinter2.onNewAvailable(myTest2);
assertAllOutputs(mockPrinter2, "stdout1 ", "stderr1 ", "\nignored msg\n");
assertAllOutputs(mockPrinter2, "stdout1 ", "stderr1 ", "\nignored msg");
}
public void testProcessor_OnIgnored_WithStacktrace() {