SWTBot-Test中的SWTException:为什么它会被Tycho + Surefire抛出?

时间:2013-08-07 14:21:13

标签: java maven tycho surefire swtbot

我从所有SWTBot-Test获得SWTException:Invalid thread access。当它们从eclipse开始时它们都变成了绿色,所以问题必须在pom.xml里面。怎么解决这个问题?

我在test-fragment的pom.xml中使用以下参数和依赖项:

<!-- language: lang-xml -->
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho.version}</version>
<configuration>
    <testFailureIgnore>true</testFailureIgnore>
    <failIfNoTests>false</failIfNoTests>
    <forkedProcessTimeoutInSeconds>300</forkedProcessTimeoutInSeconds>
    <useUIHarness>true</useUIHarness>
    <useUIThread>false</useUIThread>
    <showEclipseLog>true</showEclipseLog>
    <dependencies>
        <dependency>
            <type>eclipse-plugin</type>
            <artifactId>my.host.ui.bundle</artifactId>
            <version>0.0.0</version>
        </dependency>
        <dependency>
            <type>p2-installable-unit</type>
            <artifactId>org.hamcrest</artifactId>
            <version>1.1.0</version>
        </dependency>
        <dependency>
            <type>installable-unit</type>
            <artifactId>org.eclipse.ui</artifactId>
            <version>0.0.0</version>
        </dependency>
        <dependency>
            <type>installable-unit</type>
            <artifactId>org.eclipse.ui.workbench</artifactId>
            <version>0.0.0</version>
        </dependency>
        <dependency>
            <type>p2-installable-unit</type>
            <artifactId>org.eclipse.swtbot.eclipse.core</artifactId>
            <version>2.0.4</version>
        </dependency>
        <dependency>
            <type>p2-installable-unit</type>
            <artifactId>org.eclipse.swtbot.eclipse.finder</artifactId>
            <version>2.0.4</version>
        </dependency>
        <dependency>
            <type>p2-installable-unit</type>
            <artifactId>org.eclipse.swtbot.junit4_x</artifactId>
            <version>2.0.4</version>
        </dependency>
        <dependency>
            <type>p2-installable-unit</type>
            <artifactId>org.eclipse.swtbot.swt.finder</artifactId>
            <version>2.0.4</version>
        </dependency>
        <dependency>
            <type>p2-installable-unit</type>
            <artifactId>org.eclipse.swtbot.eclipse.finder</artifactId>
            <version>2.0.4</version>
        </dependency>
        <dependency>
            <type>p2-nstallable-unit</type>
            <artifactId>org.eclipse.ui.navigator</artifactId>
            <version>0.0.0</version>
        </dependency>
        <dependency>
            <type>p2-installable-unit</type>
            <artifactId>org.eclipse.ui.views</artifactId>
            <version>0.0.0</version>
        </dependency>
    </dependencies>
</configuration>
</plugin>
</plugins>
</build>

2 个答案:

答案 0 :(得分:0)

如果你在osx上,参见this thread

否则,请。提供有关失败测试的更多详细信息

答案 1 :(得分:0)

您如何确定为您运行哪些测试? 您配置了以下内容吗?

<configuration>
                ...
                <testSuite>bundle.symbolic.name.of.test.plugin</testSuite>
                <testClass>package.of.test.suite.YourTestSuiteOrClass</testClass>
                ...
</configuration>