【问题标题】:Jenkins not able to run soapUI test: No test to runJenkins 无法运行 soapUI 测试:没有要运行的测试
【发布时间】:2022-12-10 09:48:42
【问题描述】:

我正在从 Jenkins 运行 SoapUI 测试。 我已将我的 soapui-project.xml 文件放在我的 pom.xml 所在的同一目录中,该目录位于 bitbucket 的 master 中。 Jenkins 能够选择我的 pom.xml 中的所有更改。但不运行测试。 詹金日志说“没有测试运行”

我尝试添加源代码并将我的 soapui-project.xml 文件放在 src/main/resources 中,并保持低于属性。

<sourceDirectory>src/main/resources</sourceDirectory>
<testSourceDirectory>src/main/resources</testSourceDirectory>

但行为没有改变。

我的 pom.xml 如下

<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>
    <name>Test soapui</name>
    <groupId>RestCountriesInfo</groupId>
    <artifactId>com.example.soapuitests</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>
    <description>SOAPUITesting</description>
    
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>
    
    <build>
           <!-- <sourceDirectory>src</sourceDirectory>
        <testSourceDirectory>src/main/resources</testSourceDirectory>
   -->
        <plugins>
            <plugin>
                <groupId>com.smartbear.soapui</groupId>
                <artifactId>soapui-maven-plugin</artifactId>
                <version>5.5.0</version>
 <dependencies>
                        <dependency>
                           <groupId>com.jgoodies</groupId>
                           <artifactId>forms</artifactId>
                           <version>1.2.1</version>
                        </dependency>
                    </dependencies>
                <executions>
                    <execution>
                        <id>RestCountriesInfo</id>
                        <configuration>
                            <projectFile>RestCountriesInfo-soapui-project.xml</projectFile>
                            <outputFolder>src/main/resources/report</outputFolder>
                            <testSuite>DEV</testSuite>
                            <junitReport>true</junitReport>
                            <exportAll>true</exportAll>
                            <printReport>true</printReport>
                            <testFailIgnore>true</testFailIgnore>
                        </configuration>
                        <goals>
                            <goal>test</goal>
                        </goals>
                       
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

这是詹金斯日志

Posting build status of INPROGRESS to SWC Bitbucket for commit id [d95035dda15d279d5622478d8dbd178591e1f66a] and ref 'refs/heads/master'
Failed to post build status, additional information: timeout
[API_TEST] $ /opt/maven/bin/mvn clean test
[INFO] Scanning for projects...
[INFO] 
[INFO] -------------< RestCountriesInfo:com.example.soapuitests >--------------
[INFO] Building Test soapui 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ com.example.soapuitests ---
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ com.example.soapuitests ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ com.example.soapuitests ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ com.example.soapuitests ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /opt/jenkins/workspace/Feature/Dev/API_TEST/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ com.example.soapuitests ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ com.example.soapuitests ---
[INFO] No tests to run.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.454 s
[INFO] Finished at: 2022-11-29T12:47:34+11:00
[INFO] ------------------------------------------------------------------------

知道为什么 Jenkins 无法执行我的测试。

【问题讨论】:

    标签: jenkins testing maven-2 soapui


    【解决方案1】:

    请注意,在您的日志输出中,soapui-maven-plugin 从未运行过。

    你有两个选择:

    1. 在 Jenkins 中,您可以指定目标阶段:com.smartbear.soapui:soapui-maven-plugin:5.5.0:test,按照official documentation。但是正如您所看到的,这在命令中包含了插件版本,这可能是不可取的。

    2. 您可以添加一个 &lt;phase&gt; 来运行 soapui 插件;可能是test。这进入你的&lt;configuration&gt;块。注意 &lt;goal&gt;&lt;phase&gt; 不是一回事;他们每个人都配置了不同的东西,甚至认为他们可能有相同的目标。更多信息请访问official documentation

      作为旁注,此项目的 &lt;packaging&gt; 不是 jar - 没有编译阶段。它只是pom

    【讨论】:

      猜你喜欢
      • 2019-07-05
      • 2018-07-08
      • 2014-02-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-04
      • 1970-01-01
      • 2014-05-31
      相关资源
      最近更新 更多