2012-10-08 27 views
1

我試圖建立一個與windowstester親UI測試系統。我想通過使用Tycho插件將這些測試鏈接到Maven構建過程中。爲了實踐目的,我正在使用一個示例項目。tycho surefire與windowtester親不打開正確的窗口

現在,當我構建我的項目時,一切看起來都很好,但是當測試開始時,我收到以下消息並彈出一個默認的eclipse窗口。然後在該窗口上執行測試並且-suprise失敗。

框架參數:

-application org.eclipse.tycho.surefire.osgibooter.uitest -testproperties C:\用戶\ JLA \工作空間\ com.example.addressbook.test \靶向 \萬無一失的.properties

-product com.example.addressbook.bundle.product

命令行參數:
-debug -consolelog -data C:\ Users \ jla \ workspace \ com.example.addressbook.test \ target \ work \ data -dev file:/ C:/Users/jla/workspace/com.example.addressbook.test/target/dev .properties -application 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 STACK 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> 

回答

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>