【问题标题】:SWTException in SWTBot-Test: Why is it thrown in Tycho+Surefire?SWTBot-Test 中的 SWTException:为什么会在 Tycho+Surefire 中抛出?
【发布时间】:2013-08-07 14:21:13
【问题描述】:

我从我所有的 SWTBot-Test 中得到一个SWTException:Invalid thread access。当它们从 Eclipse 开始时,它们都会变成绿色,所以我猜问题一定出在 pom.xml 中。如何解决?

我在测试片段的 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>

【问题讨论】:

    标签: java maven tycho surefire swtbot


    【解决方案1】:

    如果您使用的是 osx,请参阅。 this thread

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

    【讨论】:

    • 除了 StackTrace 之外,还有哪些有用的详细信息?
    • 我指的是测试中的实际代码。堆栈跟踪的前几行可能也有帮助。
    【解决方案2】:

    您如何告诉surefire 为您运行哪些测试? 你配置了以下吗?

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

    【讨论】:

      猜你喜欢
      • 2018-05-16
      • 1970-01-01
      • 2012-08-09
      • 1970-01-01
      • 2016-09-18
      • 2012-03-17
      • 1970-01-01
      • 2021-12-20
      • 2021-03-05
      相关资源
      最近更新 更多