问题标签 [munit]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
2329 浏览

maven - 有谁知道如何关闭 MUnit 覆盖分析?

在我的模拟测试完成并成功后,Maven 插件将启动:

[org.mule.munit.remote.CoverageManager]计算资源的应用覆盖率:app-config.xml

我删除了 POM 中覆盖率设置为“true”的配置。我改为“假”,覆盖率分析继续。

有谁知道如何关闭这个?

0 投票
1 回答
1142 浏览

mocking - 使用 MUNIT 模拟 SFTP

我已经在这里看到了同样的问题,但是答案中提供的链接现在不起作用。非常需要这个问题的解决方案。

我的 mule 流中有一个 SFTP 设置以及一个数据库。我需要模拟 SFTP 并使用 MUNIT 测试我的 mule 流。您能否分享一些有关如何处理此场景的步骤?

0 投票
2 回答
3030 浏览

installation - MUnit 错误:发生 JNI 错误,请检查您的安装并重试

我按照教程安装 MUnit 插件作为这个页面:https ://docs.mulesoft.com/munit/v/1.1.1/using-munit-in-anypoint-studio

但是,当我运行一个空的测试用例时,AnyPoint 向我返回一个错误:发生 JNI 错误,请检查您的安装并重试。

在控制台中,我看到异常为:

线程“main”中的异常 java.lang.NoClassDefFoundError: org/mule/munit/runner/mule/result/notification/NotificationListener at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Unknown Source ) 在 java.lang.Class.privateGetMethodRecursive(Unknown Source) 在 java.lang.Class.getMethod0(Unknown Source) 在 java.lang.Class.getMethod(Unknown Source) 在 sun.launcher.LauncherHelper.validateMainClass(Unknown Source) 在sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source) 引起:java.lang.ClassNotFoundException: org.mule.munit.runner.mule.result.notification.NotificationListener at java.net.URLClassLoader.findClass(Unknown Source) at java. lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader。loadClass(Unknown Source) ... 7 更多

请帮助检查是什么问题。

提前致谢。

0 投票
2 回答
2093 浏览

mocking - Mule Munit 模拟 http.uri.params

我有一个使用 http 的流程,我有一个 GET 调用,它点击类似

我知道我可以通过使用 mel 在代码中获取此参数,例如:

当我设置消息但没有成功时,我需要模拟 uri 参数。我尝试使用此名称在“设置消息”中进行设置

但是当我运行测试时它似乎出错了。

这是在 mule server 3.7.3 上使用 munit 流

0 投票
3 回答
2719 浏览

maven - 使用 maven 时 SAP 连接器的 Munit 问题,

嗨,我在使用 maven 代码运行 munit 时面临以下问题我有一个包含 sap 连接器的流,然后为流完成了 munit 并尝试使用 maven 运行 munit,得到以下异常,需要帮助:。

0 投票
3 回答
6180 浏览

mule - 为 MUnit Mule 测试设置 HTTP Url 参数

我有一个想要测试的流程。流具有 HTTP 入站连接器,流本身充当 RESTful 服务。

该流程需要设置一些 URL 参数,并使用标准符号在整个过程中访问这些参数:#[message.inboundProperties.'http.query.params'.test].

我想使用 MUnit 测试这个流程。当我针对流创建默认 MUnit 测试时,MUnit 会创建一个 flow-ref 来调用我的原始流。但是,运行此测试会立即失败,因为流程需要通过 HTTP 调用,并且需要设置 URL 参数。

这就是我现在的位置。我希望在调用 flow-ref 之前设置这些变量,以便我的流程可以正常处理。

我尝试了几件事:

  • 使用munit:set组件,它允许设置各种属性
  • 手动实例化 aMessagePropertyMapContext并将其分配给http.query.params变量
  • flow-ref组件替换HTTP组件并用实际的 HTTP 消息调用流

这些似乎都不能正常工作。

变量设置似乎总是失败,并在NullPointerException尝试访问变量时导致。

使用HTTP组件调用流程不起作用,因为 Mule 随机分配了一个端口进行测试,而我似乎无法在运行时访问该端口。因此我无法调用端点。

我在这里这里寻找过类似的问题,但它们似乎对我没有帮助。

所以我的基本问题是:当从 MUnit 测试中进行测试时,如何设置流可以访问的 URL 参数。有没有更好的方法来实现我在这里想要实现的目标?

谢谢!

0 投票
1 回答
1166 浏览

mule - 在 mule 的 munit 中使用 assert-payload 选项

我在为流运行 munit 测试用例时将 xml 文件作为输出,但是为了确保输出正确与否,我想在 munit 中使用断言有效负载选项。

请帮助我如何确保代码功能正常工作并且输出符合预期。

0 投票
2 回答
4156 浏览

maven - MUnit 测试导致 Maven 构建失败

我有一个 Maven 化的 Anypoint Studio 项目,该项目在执行时 Maven 构建失败mvn clean package;但是,运行mvn clean package -DskipMunitTests会导致构建成功。

堆栈跟踪:

POM 文件:

进口:

.properties在 src/main/app 和 src/main/resources 文件夹中确实有文件,我也尝试过导入但没有成功。

我应该提到,Munit 测试确实在 Anypoint Studio 中成功运行。

我已经为此苦苦挣扎了几天,似乎无法发现问题。

这个问题Mavenized Mule project but Munit test run is failed与我的非常接近,但仍然不是我所需要的。

任何帮助或见解将不胜感激。

谢谢。

0 投票
1 回答
1088 浏览

xml - Maven 为 Munits 构建 - Mule

我正在准备 maven 来构建包含 munit 的 mule 应用程序。当我“mvn package”应用程序时出现以下错误。

WARN 2016-11-11 09:35:32,415 [main] org.springframework.beans.factory.xml.XmlBeanDefinitionReader:忽略 XML 验证警告 org.xml.sax.SAXParseException:schema_reference.4:无法读取架构文档' http: //www.mulesoft.org/schema/mule/ws/current/mule-ws.xsd ',因为1)找不到文件;2) 文件无法读取;3) 文档的根元素不是 . 在 org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) ~[xercesImpl-2.8.0.jar:?] at org.apache.xerces.util.ErrorHandlerWrapper.warning(Unknown Source) ~[xercesImpl-2.8. 0.jar:?]

[错误] 无法执行目标 com.mulesoft.munit.tools:munit-maven-plugin:1.2.1:test (test) on project api-system-plm-material: 目标 com.mulesoft.munit.tools 的执行测试:munit-maven-plugin:1.2.1:test failed: org.mule.api.config.ConfigurationException: 来自 URL [file:/D:/Mule-Workspace-28thOct/myapplication/target/test-的 XML 文档中的第 19 行classes/myapplication_flow1.xml] 无效;嵌套异常是 org.xml.sax.SAXParseException;行号:19;列号:105;cvc-complex-type.2.4.a:发现以元素“ws:consumer-config”开头的无效内容。“{”之一http://www.mulesoft.org/schema/mule/core “:annotations,” http://www.mulesoft.org/schema/mule/core “:description,” http://www .springframework。":beans, " http://www.springframework.org/schema/beans ":bean, " http://www.springframework.org/schema/context ":property-placeholder, " http://www.springframework .org/schema/beans ":ref, " http://www.mulesoft.org/schema/mule/core ":global-property, " http://www.mulesoft.org/schema/mule/core ":配置,“ http://www.mulesoft.org/schema/mule/core ”:通知,“ http://www.mulesoft.org/schema/mule/core ”:abstract-extension,“ http://www .mulesoft.org/schema/mule/core ":abstract-shared-extension, " http://www.mulesoft.org/schema/mule/core ":抽象混合内容扩展,“http://www.mulesoft.org/schema/mule/core ":abstract-agent, " http://www.mulesoft.org/schema/mule/core ":abstract-security-manager, " http:// www.mulesoft.org/schema/mule/core ":abstract-transaction-manager, " http://www.mulesoft.org/schema/mule/core ":abstract-shared-transaction-manager, " http:// www.mulesoft.org/schema/mule/core ":abstract-connector, " http://www.mulesoft.org/schema/mule/core ":abstract-shared-connector, " http://www.mulesoft. org/schema/mule/core ":abstract-global-endpoint, " http://www.mulesoft.org/schema/mule/core ":abstract-exception-strategy, " http://www.mulesoft.org/schema/mule/core":abstract-flow-construct, " http://www.mulesoft.org/schema/mule/core":flow , " http://www.mulesoft.org/schema/mule/core":sub-flow , " http://www.mulesoft.org/schema/mule/core ":abstract-model, " http://www.mulesoft.org/schema/mule/core ":abstract-interceptor-stack, " http:// /www.mulesoft.org/schema/mule/core ":abstract-filter," http://www.mulesoft.org/schema/mule/core ":abstract-transformer," http://www.mulesoft.org /schema/mule/core “:处理器链,” http://www.mulesoft.org/schema/mule/core “:自定义处理器,” http://www.mulesoft。org/schema/mule/core ":abstract-empty-processor, "http://www.mulesoft.org/schema/mule/core ":invoke, " http://www.mulesoft.org/schema/mule/core ":set-payload, " http://www.mulesoft. org/schema/mule/core ":abstract-global-intercepting-message-processor, " http://www.mulesoft.org/schema/mule/core ":custom-queue-store, " http://www. mulesoft.org/schema/mule/core“:abstract-processing-strategy}”是预期的。(org.mule.api.lifecycle.InitialisationException)-> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException:无法执行目标com.mulesoft.munit.tools :munit-maven-plugin:1.2.1:test (test) on project api-system-plm-material: 目标com.mulesoft.munit.tools的执行测试:munit-maven-plugin:1.2.1:test failed: org.mule.api.config.ConfigurationException:来自 URL [file:/D:/Mule-Workspace-28thOct/myapplication/target/test-classes/myapplication_flow1.xml] 的 XML 文档中的第 19 行无效;嵌套异常是 org. xml.sax.SAXParseException;lineNumber:19;columnNumber:105;cvc-complex-type.2.4.a:发现以元素“ws:consumer-config”开头的无效内容。“{”之一http://www。 mulesoft.org/schema/mule/core":annotations, " http://www.mulesoft.org/schema/mule/core ":description, " http://www.springframework.org/schema/beans ":beans, " http://www.springframework .org/schema/beans ":bean, " http://www.springframework.org/schema/context ":property-placeholder, " http://www.springframework.org/schema/beans ":ref, " http ://www.mulesoft.org/schema/mule/core ":global-property, " http://www.mulesoft.org/schema/mule/core ":configuration, " http://www.mulesoft.org /schema/mule/core ":notifications, " http://www.mulesoft.org/schema/mule/core ":抽象扩展,“ http://www.mulesoft.org/schema/mule/core":abstract-shared-extension, " http://www.mulesoft.org/schema/mule/core ":abstract-mixed-content-extension, " http://www.mulesoft.org/schema/mule/core ":abstract-agent, " http://www.mulesoft.org/schema/mule/core ":abstract-security-manager, " http://www.mulesoft.org/schema/mule/core ":abstract-事务管理器,“ http://www.mulesoft.org/schema/mule/core ”:abstract-shared-transaction-manager,“ http://www.mulesoft.org/schema/mule/core ”:abstract-连接器,“ http://www.mulesoft.org/schema/mule/core ”:abstract-shared-connector,“ http://www.mulesoft.org/schema/mule/core ”:抽象全局端点,"http://www.mulesoft.org/schema/mule/core ":abstract-exception-strategy, " http://www.mulesoft.org/schema/mule/core ":abstract-flow-construct, " http: //www.mulesoft.org/schema/mule/core ":flow, " http://www.mulesoft.org/schema/mule/core ":sub-flow, " http://www.mulesoft.org/ schema/mule/core ":abstract-model, " http://www.mulesoft.org/schema/mule/core ":abstract-interceptor-stack, " http://www.mulesoft.org/schema/mule/核心“:抽象过滤器”,“ http://www.mulesoft.org/schema/mule/core ”:抽象变压器,“ http://www.mulesoft.org/schema/mule/core ”:处理器链,"http://www.mulesoft.org/schema/mule/core ":custom-processor, " http://www.mulesoft.org/schema/mule/core ":abstract-empty-processor, " http:// www.mulesoft.org/schema/mule/core ":invoke, " http://www.mulesoft.org/schema/mule/core ":set-payload, " http://www.mulesoft.org/schema/ mule/core ":abstract-global-intercepting-message-processor, " http://www.mulesoft.org/schema/mule/core ":custom-queue-store, " http://www.mulesoft.org/ schema/mule/core ":abstract-processing-strategy}' 是预期的。 (org.mule.api.lifecycle.InitialisationException) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)

它所指的流xml是:

http://www.springframework.org/schema/beans/spring-beans-current.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/核心/当前/mule.xsd http://www.mulesoft.org/schema/mule/ws http://www.mulesoft.org/schema/mule/ws/current/mule-ws.xsd http://www .mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd ">

下面是我的 pom.xml:

任何线索都会有很大帮助。

编辑:

在添加 Dds 指示的依赖项后,我现在遇到以下错误: [ERROR] Failed to execute goal com.mulesoft.munit.tools:munit-maven-plugin:1.2.1:test (test) on project myapplication: Execution test of goal com.mulesoft.munit.tools:munit-maven-plugin:1.2.1:test failed: org.mule.api.config.ConfigurationException: Configuration problem: Failed to import bean definitions from URL location [classpath:myapplication-get-id.xml] [ERROR] Offending resource: URL [file:/D:/RamG/Eclipses/Workspaces/Mule-Workspace-28thOct/myapplication/target/test-classes/myapplication-apikit-test.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [myapplication-get-id.xml]; nested exception is org.springframework.beans.FatalBeanException: Invalid NamespaceHandler class [com.mulesoft.weave.mule.config.WeaveNamespaceHandler] for namespace [http://www.mulesoft.org/schema/mule/ee/dw]: problem with handler class file or dependent class; nested exception is java.lang.NoClassDefFoundError: scala/Option (org.mule.api.lifecycle.InitialisationException): scala.Option [ERROR] -> [Help 1] 当我浏览信息时,我看到又发布了一个 SO 问题但没有得到回答。它指的是 dataweave + scala/Option 这与我得到的错误相同。

由于某种原因,这个 dataweave 组件没有被完全下载,尤其是 jar 文件没有被下载。经过一些练习,我手动下载并复制到相应的 .m2 文件夹。但之后我看到了上述错误。所以,它要么有一些像“scala/Option”这样没有解决的依赖项!!我不确定。

谢谢

0 投票
2 回答
1207 浏览

maven - munit 套件没有运行,我希望有一些配置问题

这是我使用的代码:

错误是:

java.lang.RuntimeException:org.mule.api.config.ConfigurationException:配置问题:无法从 URL 位置导入 bean 定义 [classpath:properties/sip-eclinical-integ_Dev.properties]

违规资源:URL [file:/D:/DEVISWorkspace/Sip/SIP/sip-eclinical-Integ/src/test/munit/assign-studysite-user-role-test-suite.xml];嵌套异常是 org.springframework.beans.factory。

xml.XmlBeanDefinitionStoreException:来自类路径资源 [properties/sip-eclinical-integ_Dev.properties] 的 XML 文档中的第 1 行无效;嵌套异常是 org.xml.sax.SAXParseException;行号:1;列号:1;序言中不能有内容。(org.mule.api.lifecycle.InitialisationException)