我RCP是在Eclipse的3.x的创建,现在是在使用了兼容层4.x版。 这是我的设置:我有两个插件: xyz-plugin
和xyz-rcp-plugin
。 我的RCP应用程序由这两个插件。 我有一个测试片段( xyz-test
),其主机插件是xyz-plugin
,并包含了SWTBot测试。 我的产品配置指向应用程序中的plugin.xml中定义xyz-rcp-plugin
。
当我通过Eclipse运行了SWTBot测试,这一切工作正常。 我将其指向主要选项卡上的正确应用,并启动正确的。
当我尝试通过Maven来运行它(使用mvn integration-test
),该命令后启动测试的UI,没有用户界面打开,它只是报告说有测试失败,但它从来没有真正甚至达到阶段测试我的情况下, 。
我觉得这是发生,因为我的测试片段只有xyz-plugin
作为它的主人,因此知道它的依赖性,但应用程序实际上是包含在xyz-rcp-plugin
所以我猜测它不把那个插件安装到测试工作区。 事实上,当我省略测试运行<application>
在我的POM文件配置; 简单启动默认是在Eclipse SDK。
所以,但我怎样才能使了SWTBot测试运行我的应用程序,如果与应用程序的插件是不是测试插件的依赖?
下面是测试片段我的POM文件,
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.xyz</groupId>
<artifactId>all</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>com.xyz.test</artifactId>
<packaging>eclipse-test-plugin</packaging>
<properties>
<ui.test.vmargs></ui.test.vmargs>
</properties>
<profiles>
<profile>
<id>macosx</id>
<activation>
<os>
<family>mac</family>
</os>
</activation>
<properties>
<ui.test.vmargs>-XstartOnFirstThread</ui.test.vmargs>
</properties>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<useUIHarness>true</useUIHarness>
<useUIThread>false</useUIThread>
<product>com.xyz.rcp.product</product>
<application>com.xyz.rcp.Application</application>
<argLine>${ui.test.vmargs}</argLine>
<dependencies>
<dependency>
<!-- explicit dependency is only needed because SWTbot brings its
own hamcrest bundle which conflicts with the one from junit in the eclipse
platform -->
<type>p2-installable-unit</type>
<artifactId>org.hamcrest</artifactId>
<version>0.0.0</version>
</dependency>
</dependencies>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-xyz</id>
<phase>compile</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<excludeTransitive>true</excludeTransitive>
<includeTypes>tar.gz</includeTypes>
<outputDirectory>${project.build.directory}/work</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>