gpt4 book ai didi

testing - 如何在 Maven 中启动和停止 mule

转载 作者:行者123 更新时间:2023-11-28 20:05:03 25 4
gpt4 key购买 nike

我需要在运行测试之前启动 Mule,并在测试完成时停止它。我不清楚如何更改我的 Maven pom 来完成此操作。到目前为止,我的 pom 中有以下内容:

        <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>java</executable>
<arguments>
<argument>-classpath</argument>
<classpath/>
<argument>org.mule.MuleServer</argument>
<argument>-config</argument>
<argument>my-config.xml</argument>
</arguments>
</configuration>
</plugin>

---更新---

在下面的一些回复之后,我决定添加一些额外的细节。

我有几个扩展 Mules FunctionalTestCase 类的单元测试:

public class SomeUnitTest extends FunctionalTestCase

我开始使用 JBehave 编写一些新的客户验收测试,这些测试在专家的“集成测试”阶段运行。如果没有运行 mule 的实例,这些测试就无法成功。加载和执行故事的主类已经扩展了 JUnitStories 类:

public class MyStories extends JUnitStories 

因为我不能在这个类中继承 FunctionalTestCase,所以我需要寻找替代方法来让 mule 在我需要它时运行和停止这些故事。

最佳答案

为什么不使用 Mule 的 FunctionalTestCase 呢?它会启动内存中的 Mule 并加载您的配置。不确定您从启动整个独立的 Mule 中获得了什么。

关于testing - 如何在 Maven 中启动和停止 mule,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8390320/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com