当前位置: 首页 > 知识库问答 >
问题:

SWTbot:使用tycho运行时出错

陆子航
2023-03-14

我们正在为eclipse RCP应用程序编写SwtBot测试用例,它在eclipse中运行良好。现在,我们正在将测试套件与现有的tycho集成,这样在创建产品时,测试用例也可以执行。下面提到为SWTBot测试套件创建的pom.xml:

 <?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.test</groupId>
        <artifactId>com.test.demo.client.gui</artifactId>
        <version>6.0.0-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>

    </parent>
  <artifactId>com.tsystem.demo.client.gui.swtbot.test</artifactId>
  <version>6.0.0-SNAPSHOT</version>
    <packaging>eclipse-test-plugin</packaging>
  <name>demoEVO GUI :: USER SWTBOT</name>

  <build>
    <plugins>
      <plugin>
        <groupId>org.eclipse.tycho</groupId>
            <artifactId>tycho-surefire-plugin</artifactId>
                <version>0.20.0</version>
        <configuration>
          <useUIHarness>true</useUIHarness>
          <useUIThread>false</useUIThread>
          <!-- use our product and application to launch the tests -->
          <product>com.test.demo.client.gui.ui.product</product>
          <application>com.test.demo.client.gui.ui.application</application>
         </configuration>
      </plugin>
    </plugins>
  </build>
</project>
    <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <prerequisites>
        <maven>3.0</maven>
    </prerequisites>

    <groupId>com.test</groupId>
    <artifactId>com.test.demo.client.gui</artifactId>
    <version>6.0.0-SNAPSHOT</version>

    <packaging>pom</packaging>

    <name>demoEVO GUI :: PARENT</name>

    <modules>
        <module>com.test.demo.client.gui.ui</module>

        <module>com.test.demo.client.gui.feature</module>
        <module>com.test.demo.client.gui.product</module>
        <module>com.tsystem.demo.client.gui.swtbot.test</module>

    </modules>

    <repositories>
        <repository>
            <id>eclipse</id>
            <layout>p2</layout>
            <url>${eclipse-site}</url>
        </repository>
        <repository>
            <id>orbit</id>
            <layout>p2</layout>
            <url>${orbit-site}</url>
        </repository>
        <repository>
            <id>ajdt</id>
            <layout>p2</layout>
            <url>${ajdt-site}</url>
        </repository>
        <repository>
            <id>p2-babel</id>
            <layout>p2</layout>
            <url>http://download.eclipse.org/technology/babel/update-site/R0.11.1/indigo</url>
        </repository>
           <repository>
     <id>swtbot</id>
     <layout>p2</layout>
     <url>http://download.eclipse.org/technology/swtbot/releases/latest/</url>
   </repository>

    </repositories>

    <properties>
        <tycho-version>0.20.0</tycho-version>
        <platform-version-name>indigo</platform-version-name>
        <eclipse-site>http://download.eclipse.org/releases/${platform-version-name}</eclipse-site>
        <orbit-site>http://download.eclipse.org/tools/orbit/downloads/drops/R20110523182458/repository</orbit-site>
        <ajdt-site>http://download.eclipse.org/tools/ajdt/37/update/</ajdt-site>
    </properties>

    <build>
        <sourceDirectory>src</sourceDirectory>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.0</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>tycho-maven-plugin</artifactId>
                <version>${tycho-version}</version>
                <extensions>true</extensions>
            </plugin>
            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>target-platform-configuration</artifactId>
                <version>${tycho-version}</version>
                <configuration>
                    <pomDependencies>consider</pomDependencies>
                    <resolver>p2</resolver>
                    <environments>
                        <environment>
                            <os>win32</os>
                            <ws>win32</ws>
                            <arch>x86</arch>
                        </environment>
                    </environments>
                </configuration>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.eclipse.tycho</groupId>
                    <artifactId>tycho-compiler-plugin</artifactId>
                    <version>${tycho-version}</version>
                    <configuration>
                        <encoding>UTF-8</encoding>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.eclipse.tycho</groupId>
                    <artifactId>tycho-p2-director-plugin</artifactId>
                    <version>${tycho-version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>2.4.1</version>
                    <configuration>
                        <encoding>UTF-8</encoding>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <version>1.3</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
    <dependencies>
        <dependency>
            <groupId>com.test</groupId>
            <artifactId>com.test.demo.client.gui.framework.core</artifactId>
            <version>${project.version}</version>
            <type>eclipse-plugin</type>
        </dependency>
        <dependency>
            <groupId>com.test</groupId>
            <artifactId>
                com.test.demo.client.gui.automation.ui
            </artifactId>
            <version>${project.version}</version>
            <type>eclipse-plugin</type>
        </dependency>
        <dependency>
            <groupId>com.test</groupId>
            <artifactId>com.test.demo.client.gui.key.ui</artifactId>
            <version>${project.version}</version>
            <type>eclipse-plugin</type>
        </dependency>
        <dependency>
            <groupId>com.test</groupId>
            <artifactId>
                com.test.demo.client.gui.parameter.ui
            </artifactId>
            <version>${project.version}</version>
            <type>eclipse-plugin</type>
        </dependency>
        <dependency>
            <groupId>com.test</groupId>
            <artifactId>
                com.test.demo.client.gui.station.ui
            </artifactId>
            <version>${project.version}</version>
            <type>eclipse-plugin</type>
        </dependency>
        <dependency>
            <groupId>com.test</groupId>
            <artifactId>com.test.demo.client.gui.user.ui</artifactId>
            <version>${project.version}</version>
            <type>eclipse-plugin</type>
        </dependency>
        <dependency>
            <groupId>com.test</groupId>
            <artifactId>com.test.demo.client.gui.monitor.ui</artifactId>
            <version>${project.version}</version>
            <type>eclipse-plugin</type>
        </dependency>
        <dependency>
            <groupId>com.test</groupId>
            <artifactId>
                com.test.demo.client.gui.transfer.ui
            </artifactId>
            <version>${project.version}</version>
            <type>eclipse-plugin</type>
        </dependency>
    </dependencies>

</project>
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-surefire-plugin:0.20.0:test (default-test) on project com.tsystem.rvs.client.gui.swtbot.test: An unexpected er
ror occured (return code -1). See log for details. -> [Help 1]
!SESSION 2014-08-01 16:21:02.349 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.6.0_45
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Framework arguments:  -application org.eclipse.tycho.surefire.osgibooter.uitest -testproperties D:\demo_EVO_PRODUCT_SWT\com.test.demo.client.gui\trunk\com.tsystem.demo.client.gui.swtbot.test\target\surefire.properties -testApplication com.test.demo.client.gui.ui.application -product com.test.demo.client.gui.ui.product -nouithread
Command-line arguments:  -data D:\demo_EVO_PRODUCT_SWT\com.test.demo.client.gui\trunk\com.tsystem.demo.client.gui.swtbot.test\target\work\data -application org.eclipse.tycho.surefire.osgibooter.uitest -testproperties D:\demo_EVO_PRODUCT_SWT\com.test.demo.client.gui\trunk\com.tsystem.demo.client.gui.swtbot.test\target\surefire.properties -testApplication com.test.demo.client.gui.ui.application -product com.test.demo.client.gui.ui.product -nouithread

!ENTRY org.eclipse.osgi 2 0 2014-08-01 16:21:03.564
!MESSAGE The following is a complete list of bundles which are not resolved, see the prior log entry for the root cause if it exists:
!SUBENTRY 1 org.eclipse.osgi 2 0 2014-08-01 16:21:03.564
!MESSAGE Bundle com.tsystem.demo.client.gui.swtbot.test_6.0.0.qualifier [1] was not resolved.
!SUBENTRY 2 com.tsystem.demo.client.gui.swtbot.test 2 0 2014-08-01 16:21:03.564
!MESSAGE Missing host com.test.demo.client.gui.ui_0.0.0.
!SUBENTRY 2 com.tsystem.demo.client.gui.swtbot.test 2 0 2014-08-01 16:21:03.564
!MESSAGE Missing required bundle com.test.demo.client.gui.framework.core_6.0.0.
!SUBENTRY 1 org.eclipse.osgi 2 0 2014-08-01 16:21:03.564
!MESSAGE Bundle com.test.demo.client.gui.ui_6.0.0.201408011050 [2] was not resolved.
!SUBENTRY 2 com.test.demo.client.gui.ui 2 0 2014-08-01 16:21:03.564
!MESSAGE Missing required bundle com.test.demo.client.gui.framework.core_6.0.0.
!SUBENTRY 1 org.eclipse.osgi 2 0 2014-08-01 16:21:03.564
!MESSAGE Bundle com.test.demo.client.gui.framework.core_6.0.0.201408010530 [6] was not resolved.
!SUBENTRY 2 com.test.demo.client.gui.framework.core 2 0 2014-08-01 16:21:03.564
!MESSAGE Missing Constraint: Bundle-RequiredExecutionEnvironment: JavaSE-1.7

请让我知道配置有什么问题?

共有1个答案

曹昊焱
2023-03-14

您的产品是JUnit测试运行器吗?如果没有,则不能将其配置为tycho-surefire-plugin配置中的 。如果这样做,则没有测试运行程序,因此不会执行任何测试。

如果您希望确保您的产品是测试运行时的一部分,则需要以下配置:

<plugin>
    <groupId>org.eclipse.tycho</groupId>
    <artifactId>target-platform-configuration</artifactId>
    <version>${tycho-version}</version>
    <configuration>
        <dependency-resolution>
            <extraRequirements>
                <requirement>
                    <type>p2-installable-unit</type>
                    <id>your-product-iu-id</id>
                    <versionRange>0.0.0</versionRange>
                </requirement>
            </extraRequirements>
        </dependency-resolution>
    </configuration>
</plugin>
 类似资料:
  • 我们正在为EclipseRCP应用程序编写SWTBot测试。我们的RCP应用程序包括NatTable组件,并具有启用/禁用透视图的授权机制。从Eclipse启动测试套件时,它工作正常。现在我们正试图将其与第谷整合。 这是pom。为运行SWTBot测试套件而创建的xml: 当我们执行Tycho构建以启动SWTBot测试套件时,我们得到以下错误: [错误]无法执行目标组织。日食第谷:第谷surefir

  • 我使用下面的命令来运行我的项目。 mvn清洁安装 我使用以下命令创建了一个数据库 创建数据库密钥斗篷;将keydeave.*上的所有特权授予“keydeave”@“%”; 我使用下面的命令创建了一个docker映像,并创建了一个映像。 码头工人建造-t钥匙斗篷。 当我使用Docker运行时, docker run-p 8080:8080-e DB_VENDOR=MYSQL-e DB_ADDR=19

  • 我有几个OSGi捆绑包,它们是在Eclipse中使用普通清单管理依赖项和Maven Tycho的外部构建构建构建的。 在Equinox上运行Eclipse内部的捆绑包工作正常。用第谷建造它们效果很好。 现在我想使用Tycho Surefire运行集成测试,为此我创建了一个简单的测试包,其中包含一些基本测试。测试中的bundle依赖于OSGi容器中的其他bundle和一些小的启动级别调整,以便正确运

  • SWTBot 是一个基于 Java 的新兴开源项目,致力于实现对基于 SWT 和 Eclipse 的应用程序 GUI 的自动化测试。当前,基于 eclipse 和 SWT 的产品非常多,随之而来的对于这一类产品的自动化测试需求也就越来越多。SWTBot 本身是一种轻量级,易用的工具,能够很好的实现对于 SWT 和 Eclipse 产品的自动化测试。但是由于 SWTBot 目前尚处于孵化阶段,对于如何将其成功应用到实际项目当中论述很少。

  • 使用Maven Tycho插件的目的是什么。我在这里读到了tycho用于构建eclipse插件和OSGI包。 问题:-我们难道不能只使用普通的旧maven pom.xml文件[不使用tycho插件]来构建eclipse插件和OSGI包吗。 maven需要什么tycho插件来帮助它构建eclipse插件和OSGI包? 为什么我们要使用Maven tycho插件来构建eclipse插件和OSGI包?