Domanda

Stiamo scrivendo casi di test swtbot per l'applicazione Eclipse RCP, funziona bene nell'eclissi.Ora integrando la suite di prova con Tycho esistente in modo che durante la creazione del test del prodotto possa essere anche eseguito.Pom.XML creato per SWTBOT Test Suite è menzionato di seguito:

 <?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>
.

Abbiamo anche includere il modulo SWTBot in PARTURA POM.XML e sembra menzionato sotto:

    <?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>
.

Stiamo ottenendo sotto errore mentre Tycho prova ad eseguire i casi di test swtbot

[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]
.

Nel file di registro non è in grado di risolvere la dipendenza dei plugin dell'applicazione.Ecco il contenuto del file di registro:

!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
.

Per favore fammi sapere cosa c'è di sbagliato nella configurazione?

È stato utile?

Soluzione

Il tuo prodotto è un runner di test di Junit?In caso contrario, non è possibile configurarlo come <product> nella configurazione Tycho-SureFire-Plugin.Se lo fai, non esiste un test runner e quindi nessun test verrà eseguito.

Se si desidera assicurarsi che il tuo prodotto fa parte del test runtime, è necessario invece la seguente configurazione:

<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>
.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top