testing - 运行 munit 测试任务后 bamboo 作业失败

标签 testing mule bamboo munit

我正在尝试使用 Bamboo 为我的 Mulesoft 代码放置一个 CI 管道。我的 bamboo 作业中有结帐、构建、测试和部署步骤。该作业正在成功测试并在/target/munit 中创建测试覆盖率报告,报告测试结果,但在测试步骤结束时,日志显示“任务失败,因为预期有测试用例,但没有找到。”整个工作都失败了。我不明白为什么?没有错误,日志中有警告。只是线和步骤失败了。知道为什么吗?以下是我的 pom.xml、命令和日志。

** simple 2018 年 10 月 14 日 13:47:56 任务失败,因为预期有测试用例,但没有找到。 简单 2018 年 10 月 14 日 13:47:56 完成任务“测试代码”,结果:失败****

我的命令如下:

mvn clean test -s settings.xml


<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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>
    <groupId>com.hcl.adc.mule</groupId>
    <artifactId>mycontacts-mule-api</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>mule</packaging>
    <name>Mule mycontacts-mule-api Application</name>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <mule.version>3.9.0</mule.version>
        <mule.munit.support.version>3.9.1</mule.munit.support.version>
        <munit.version>1.3.7</munit.version>
        <mule.tools.version>1.7</mule.tools.version>
        <application-name>mycontacts-mule-api</application-name>
        <proxy.api.version>1.0:15535407</proxy.api.version>
        <implementation.host>null</implementation.host>
        <implementation.port>80</implementation.port>
        <implementation.path>/api</implementation.path>
        <deployment-type>Cloudhub</deployment-type>
        <businessGroup>PARADIGM</businessGroup>
        <workerType>Small</workerType>
        <workers>1</workers>
        <environment>SIT</environment>
        <maven-deploy-plugin-version>2.8</maven-deploy-plugin-version>
        <mule-maven-plugin-version>2.0</mule-maven-plugin-version>
        <deploy.prop.deployEnv>sit</deploy.prop.deployEnv>
        <deploy.prop.envPrefix>sit</deploy.prop.envPrefix>
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>${maven-deploy-plugin-version}</version>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.mule.tools.maven</groupId>
                <artifactId>mule-maven-plugin</artifactId>
                <version>${mule-maven-plugin-version}</version>
                <configuration>
                    <deploymentType>${deployment-type}</deploymentType>
                    <muleVersion>${mule.version}</muleVersion>
                    <applicationName>${application-name}</applicationName>
                    <username>${mule-username}</username>
                    <password>${mule-password}</password>

                    <businessGroup>${business-group}</businessGroup>

                    <redeploy>true</redeploy>
                    <workerType>${worker-size}</workerType>
                    <workers>${worker-count}</workers>
                    <environment>${env-name}</environment>
                    <properties>
                        <anypoint.platform.client_id>${mule-client-id}</anypoint.platform.client_id>
                        <anypoint.platform.client_secret>${mule-client-secret}</anypoint.platform.client_secret>
                        <anypoint.platform.analytics_base_uri>https://analytics-ingest.anypoint.mulesoft.com</anypoint.platform.analytics_base_uri>
                        <anypoint.platform.platform_base_uri>https://anypoint.mulesoft.com/apiplatform</anypoint.platform.platform_base_uri>
                        <anypoint.platform.coreservice_base_uri>https://anypoint.mulesoft.com/accounts</anypoint.platform.coreservice_base_uri>
                        <anypoint.platform.contracts_base_uri>https://anypoint.mulesoft.com/apigateway/ccs</anypoint.platform.contracts_base_uri>
                        <deploy-env>${deploy.prop.deployEnv}</deploy-env>
                        <env>${deploy.prop.env}</env>
                        <enable.analytics>true</enable.analytics>
                        <proxy.api.version>1.0:15535407</proxy.api.version>
                        <implementation.host>null</implementation.host>
                        <implementation.port>80</implementation.port>
                        <implementation.path>/api</implementation.path>
                    </properties>
                </configuration>
                <executions>
                    <execution>
                        <id>deploy</id>
                        <phase>deploy</phase>
                        <goals>
                            <goal>deploy</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.mulesoft.munit.tools</groupId>
                <artifactId>munit-maven-plugin</artifactId>
                <version>${munit.version}</version>
                <executions>
                    <execution>
                        <id>test</id>
                        <phase>test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <coverage>
                        <ignoreFlows>
                            <ignoreFlow>mycontacts-mule-api-console</ignoreFlow>
                            <ignoreFlow>mycontacts-mule-api-apiKitGlobalExceptionMapping</ignoreFlow>
                        </ignoreFlows> 
                        <runCoverage>true</runCoverage>
                        <formats>
                            <format>html</format>
                            <format>console</format>
                            <format>json</format>
                        </formats>
                    </coverage>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.mule.tools.maven</groupId>
                <artifactId>mule-app-maven-plugin</artifactId>
                <version>${mule.tools.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <copyToAppsDirectory>true</copyToAppsDirectory>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>1.7</version>
                <executions>
                    <execution>
                        <id>add-resource</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>add-resource</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>src/main/app/</directory>
                                </resource>
                                <resource>
                                    <directory>mappings/</directory>
                                </resource>
                                <resource>
                                    <directory>src/main/api/</directory>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <testResources>
            <testResource>
                <directory>src/test/munit</directory>
            </testResource>
            <testResource>
                <directory>src/test/resources</directory>
            </testResource>
        </testResources>
    </build>

    <!-- Mule Dependencies -->
    <dependencies>
        <!-- Xml configuration -->
        <dependency>
            <groupId>com.mulesoft.muleesb</groupId>
            <artifactId>mule-core-ee</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <!-- Xml configuration -->
        <dependency>
            <groupId>com.mulesoft.muleesb.modules</groupId>
            <artifactId>mule-module-spring-config-ee</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <!-- Mule Transports -->
        <dependency>
            <groupId>org.mule.transports</groupId>
            <artifactId>mule-transport-file</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.transports</groupId>
            <artifactId>mule-transport-http</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.mulesoft.muleesb.transports</groupId>
            <artifactId>mule-transport-jdbc-ee</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.mulesoft.muleesb.transports</groupId>
            <artifactId>mule-transport-jms-ee</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.transports</groupId>
            <artifactId>mule-transport-vm</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <!-- Mule Modules -->
        <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-scripting</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-xml</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <!-- for testing -->
        <dependency>
            <groupId>org.mule.tests</groupId>
            <artifactId>mule-tests-functional</artifactId>
            <version>${mule.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-apikit</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <!-- dependencies for Mule CoE Begins -->
        <!-- https://mvnrepository.com/artifact/guru.nidi.raml/raml-tester-standalone -->
        <dependency>
            <groupId>com.mulesoft.anypoint</groupId>
            <artifactId>mule-module-proxy</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.mulesoft.anypoint</groupId>
            <artifactId>mule-module-raml-el-gw</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.mulesoft.anypoint</groupId>
            <artifactId>mule-module-spring-config-gw</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
         </dependency>
         <dependency>
            <groupId>com.mulesoft.anypoint</groupId>
            <artifactId>api-gateway-client</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
         </dependency>
         <dependency>
            <groupId>com.mulesoft.anypoint</groupId>
            <artifactId>gateway-core</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
         </dependency>
        <dependency>
            <groupId>com.mulesoft.munit</groupId>
            <artifactId>mule-munit-support</artifactId>
            <version>${mule.munit.support.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.mulesoft.munit</groupId>
            <artifactId>munit-runner</artifactId>
            <version>${munit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.mulesoft.munit.utils</groupId>
            <artifactId>munit-dbserver-module</artifactId>
            <version>1.1.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-db</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-ws</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.mulesoft.weave</groupId>
            <artifactId>mule-plugin-weave</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-json</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-cxf</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <!-- dependencies for Mule CoE Ends -->
    </dependencies>
    <repositories>
        <repository>
            <id>mulesoft-releases</id>
            <name>MuleSoft Releases Repository</name>
            <url>http://repository.mulesoft.org/releases/</url>
            <layout>default</layout>
        </repository>
        <repository>
              <id>mule-ee-releases</id>
              <name>MuleEE Releases Repository</name>
              <url>https://repository-master.mulesoft.org/nexus/content/repositories/releases-ee/</url>
        </repository>
        <repository> 
            <id>nexus-ee</id> 
            <name>nexus-ee</name> 
            <url>https://repository.mulesoft.org/nexus-ee/content/repositories/releases-ee/</url> 
            <layout>default</layout> 
            <releases> 
               <enabled>true</enabled> 
            </releases> 
            <snapshots> 
               <enabled>false</enabled> 
            </snapshots> 
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>mulesoft-release</id>
            <name>mulesoft release repository</name>
            <layout>default</layout>
            <url>http://repository.mulesoft.org/releases/</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
        <pluginRepository>
            <id>mule-public</id>
            <url>https://repository.mulesoft.org/nexus/content/repositories/releases</url>
        </pluginRepository>
    </pluginRepositories>
</project>

最佳答案

升级 munit 插件版本解决了这个问题!

关于testing - 运行 munit 测试任务后 bamboo 作业失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52803676/

相关文章:

mysql - 尽管检查的行数相似,为什么查询时间会激增?

javascript - 使用 NightmareJS 模拟内置对象

java - 调用方法失败。消息负载的类型为 : String

mule - 无法使用 `++` 、 (`String` 调用 `Array<String>` )

bamboo - 将 Bamboo 工艺品从一个项目转移到另一个项目

java - Bamboo 代理 - 错误 SSLPeerUnverifiedException : peer not authenticated

.net - 在单元测试中检测终结异常

selenium - headless (headless) chrome 的字距调整问题

java - Mule 3.7.3 - Dataveawe 消息转换器编码错误

git - Bamboo Gradle 构建失败并显示 "fatal: No names found, cannot describe anything"