سؤال

نحن نكتب حالات اختبار SwtBot لتطبيق Eclipse RCP، وهو يعمل بشكل جيد في Eclipse.نقوم الآن بدمج مجموعة الاختبار مع tycho الحالي بحيث يمكن أيضًا تنفيذ حالة اختبار المنتج أثناء إنشاء المنتج.تم ذكر Pom.xml الذي تم إنشاؤه لمجموعة اختبار SWTBot أدناه:

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

لقد قمنا أيضًا بتضمين وحدة SWTBot في ملف pom.xml الأصلي ويبدو كما هو مذكور أدناه:

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

لقد حصلنا على الخطأ أدناه أثناء محاولة Tycho تنفيذ حالات اختبار 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]

في ملف السجل، لا يتمكن من حل تبعية المكونات الإضافية للتطبيق.فيما يلي محتويات ملف السجل:

!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

من فضلك اسمحوا لي أن أعرف ما هو الخطأ في التكوين؟

هل كانت مفيدة؟

المحلول

هل منتجك هو عداء اختبار JUnit؟إذا لم يكن الأمر كذلك، فلا يمكنك تكوينه كـ <product> في تكوين البرنامج المساعد Tycho-surefire.إذا قمت بذلك، فلن يكون هناك عداء اختبار وبالتالي لن يتم تنفيذ أي اختبارات.

إذا كنت تريد التأكد من أن منتجك جزء من وقت التشغيل الاختباري، فأنت بحاجة إلى التكوين التالي بدلاً من ذلك:

<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>
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top