【问题标题】:tycho surefire with windowtester pro does not open correct window带有 windowtester pro 的 tycho surefire 无法打开正确的窗口
【发布时间】:2012-10-08 11:57:06
【问题描述】:

我正在尝试使用 windowtester pro 建立一个 UI 测试系统。我想通过使用 Tycho 插件将这些测试链接到 maven 构建过程中。出于练习目的,我目前正在使用一个示例项目。

现在,当我构建我的项目时,一切似乎都可以正常编译,但是当测试开始时,我收到以下消息并弹出一个默认的 Eclipse 窗口。然后在该窗口上执行测试并且 -suprise- 失败。

框架参数:

-应用程序 org.eclipse.tycho.surefire.osgibooter.uitest -testproperties C:\Users\jla\workspace\com.example.addressbook.test\target \surefire.properties

-product com.example.addressbook.bundle.product

命令行参数:
-调试 -控制台日志 -数据 C:\Users\jla\workspace\com.example.addressbook.test\target\work\data -dev 文件:/C:/Users/jla/workspace/com.example.addressbook.test/target/dev.properties -应用程序 org.eclipse.tycho.surefire.osgibooter.uitest -testproperties C:\Users\jla\workspace\com.example.addressbook.test\target \surefire.properties -product com.example.addressbook.bundle.product

!ENTRY org.eclipse.ui 4 4 2012-10-12 16:00:36.984
!MESSAGE Exception in org.eclipse.ui.internal.FolderLayout.addView(String):

org.eclipse.ui.PartInitException:未找到视图描述符: org.eclipse.ui.navigator.ProjectExplorer

!ENTRY org.eclipse.ui 4 4 2012-10-12 16:00:36.990
!MESSAGE Exception in org.eclipse.ui.internal.FolderLayout.addView(String):

org.eclipse.ui.PartInitException:未找到视图描述符: org.eclipse.ui.navigator.ProjectExplorer !堆栈 1 org.eclipse.ui.PartInitException:未找到视图描述符:org.eclipse.ui.navigator.ProjectExplorer

这是我的测试项目的 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.example.addressbook</groupId>
    <artifactId>com.example.addressbook.build</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <relativePath>../com.example.addressbook.build</relativePath>
  </parent>

  <artifactId>com.example.addressbook.test</artifactId>
  <packaging>eclipse-test-plugin</packaging>

  <build>
        <plugins>
            <plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>tycho-surefire-plugin</artifactId>
                <version>${tycho-version}</version>

                <configuration>
                    <testSuite>com.example.addressbook.test</testSuite>
                    <testClass>com.example.addressbook.test.AppTest001</testClass>

                    <useUIHarness>true</useUIHarness>
                    <useUIThread>true</useUIThread>
                    <!-- use our product and application to launch the tests -->
                    <product>com.example.addressbook.bundle.product</product>
                    <!--  <application>org.eclipse.ui.ide.workbench</application>-->

                    <dependencies>
                        <dependency>
                            <type>p2-installable-unit</type>
                            <artifactId>com.windowtester.runtime.feature.group</artifactId>
                            <version>0.0.0</version>
                        </dependency>
                    </dependencies>
                </configuration>

            </plugin>
        </plugins>
    </build>


 </project>

【问题讨论】:

    标签: eclipse-rcp tycho window-tester tycho-surefire-plugin


    【解决方案1】:

    我终于找到了让它工作的方法。由于 tycho 使用的是 eclipse 创建的项目信息,因此需要在 MANIFEST.MF 文件中引用应该测试的项目。

    这是我的 MANIFEST.MF 文件:

        Bundle-Name: Test Bundle
    Bundle-Version: 1.0.0.qualifier
    Bundle-SymbolicName: com.example.addressbook.test
    Manifest-Version: 1.0
    Bundle-ManifestVersion: 2
    Bundle-RequiredExecutionEnvironment: JavaSE-1.6
    Require-Bundle: org.junit,
     com.windowtester.runtime,
     com.windowtester.swt.runtime,
     com.windowtester.swing.runtime,
     org.eclipse.jface,
     org.eclipse.core.runtime,
     org.eclipse.swt,
     com.example.addressbook.bundle,
     com.example.addressbook.services
    

    这就是我的 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.example.addressbook</groupId>
        <artifactId>com.example.addressbook.build</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <relativePath>../com.example.addressbook.build</relativePath>
      </parent>
    
      <artifactId>com.example.addressbook.test</artifactId>
      <packaging>eclipse-test-plugin</packaging>
    
      <build>
            <plugins>
                <plugin>
                    <groupId>org.eclipse.tycho</groupId>
                    <artifactId>tycho-surefire-plugin</artifactId>
                    <version>${tycho-version}</version>
    
                    <configuration>
                        <testSuite>com.example.addressbook.test</testSuite>
                        <testClass>com.example.addressbook.test.AppTest01</testClass>
    
                        <useUIHarness>true</useUIHarness>
                        <useUIThread>true</useUIThread>
                        <!-- use our product and application to launch the tests -->
                        <product>com.example.addressbook.bundle.product</product>
                        <application>com.example.addressbook.bundle.application</application>
    
                        <dependencies>
                            <dependency>
                                <type>p2-installable-unit</type>
                                <artifactId>com.windowtester.runtime.feature.group</artifactId>
                                <version>0.0.0</version>
                            </dependency>
                        </dependencies>
                    </configuration>
    
                </plugin>
            </plugins>
        </build>
    
    
     </project>
    

    【讨论】:

      猜你喜欢
      • 2017-10-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-04
      • 1970-01-01
      相关资源
      最近更新 更多