smRunner-tests depends only on testFramework
[fedora-idea.git] / smRunner / testSrc / com / intellij / execution / testframework / sm / runner / BaseSMTRunnerTestCase.java
blob88b3f38f82ab63cacffff847992e96456590343f
1 package com.intellij.execution.testframework.sm.runner;
3 import com.intellij.execution.configurations.RuntimeConfiguration;
4 import com.intellij.execution.runners.ExecutionEnvironment;
5 import com.intellij.execution.testframework.TestConsoleProperties;
6 import com.intellij.execution.testframework.sm.runner.ui.SMTestRunnerResultsForm;
7 import com.intellij.execution.testframework.sm.runner.ui.TestResultsViewer;
8 import com.intellij.testFramework.LightPlatformTestCase;
10 /**
11 * @author Roman Chernyatchik
13 public abstract class BaseSMTRunnerTestCase extends LightPlatformTestCase {
14 protected SMTestProxy mySuite;
15 protected SMTestProxy mySimpleTest;
17 @Override
18 protected void setUp() throws Exception {
19 super.setUp();
21 mySuite = createSuiteProxy();
22 mySimpleTest = createTestProxy();
25 protected SMTestProxy createTestProxy() {
26 return createTestProxy("test");
29 protected SMTestProxy createTestProxy(final SMTestProxy parentSuite) {
30 return createTestProxy("test", parentSuite);
33 protected SMTestProxy createTestProxy(final String name) {
34 return createTestProxy(name, null);
37 protected SMTestProxy createTestProxy(final String name, final SMTestProxy parentSuite) {
38 final SMTestProxy proxy = new SMTestProxy(name, false, null);
39 if (parentSuite != null) {
40 parentSuite.addChild(proxy);
42 return proxy;
45 protected SMTestProxy createSuiteProxy(final String name) {
46 return createSuiteProxy(name, null);
49 protected SMTestProxy createSuiteProxy(final String name, final SMTestProxy parentSuite) {
50 final SMTestProxy suite = new SMTestProxy(name, true, null);
51 if (parentSuite != null) {
52 parentSuite.addChild(suite);
54 return suite;
57 protected SMTestProxy createSuiteProxy() {
58 return createSuiteProxy("suite");
61 protected SMTestProxy createSuiteProxy(final SMTestProxy parentSuite) {
62 return createSuiteProxy("suite", parentSuite);
65 protected RuntimeConfiguration createRunConfiguration() {
66 return new MockRuntimeConfiguration(getProject());
67 //final RubyRunConfigurationFactory factory = new RubyRunConfigurationFactory(
68 // TestUnitRunConfigurationType.getInstance());
69 //return new RTestUnitRunConfiguration(getProject(), factory, "name");
72 protected TestConsoleProperties createConsoleProperties() {
73 final RuntimeConfiguration runConfiguration = createRunConfiguration();
75 final TestConsoleProperties consoleProperties = new SMTRunnerConsoleProperties(runConfiguration);
76 TestConsoleProperties.HIDE_PASSED_TESTS.set(consoleProperties, false);
78 return consoleProperties;
81 protected TestResultsViewer createResultsViewer(final TestConsoleProperties consoleProperties) {
82 final ExecutionEnvironment environment = new ExecutionEnvironment();
83 return new SMTestRunnerResultsForm(consoleProperties.getConfiguration(),
84 consoleProperties,
85 environment.getRunnerSettings(),
86 environment.getConfigurationSettings());
89 protected void doPassTest(final SMTestProxy test) {
90 test.setStarted();
91 test.setFinished();
94 protected void doFailTest(final SMTestProxy test) {
95 test.setStarted();
96 test.setTestFailed("", "", false);
97 test.setFinished();
100 protected void doErrorTest(final SMTestProxy test) {
101 test.setStarted();
102 test.setTestFailed("", "", true);
103 test.setFinished();