Questions tagged [munit]

MUnit is a Mule application testing framework that allows you to easily build automated tests for your integrations and APIs. It provides a full suite of integration and unit test capabilities, and is fully integrated with Maven and Surefire for integration with your continuous deployment environment.

It allows mule developers to automate mule app testing in an easy manner.

151 questions
4
votes
0 answers

Assert failure with same expected and actual value

Encountered munit failure with similar actual value and expected value. Both expected and actual value is in json format. But the only different is their byte array. The actual value has 419 bytes and the expected value has 600 bytes. …
Scott Jones
  • 175
  • 2
  • 12
3
votes
1 answer

Difference between projectHelper.attachArtifact and project.getArtifact().setFile

I'm currently facing an issue with the execution of my MUnit tests using the command line. I'm facing a problem of "duplicate project artifact assignment" Using version 1.2 of mule-domain-maven-plugin that was fixed here with version 1.3. Removing…
Pat B
  • 1,915
  • 23
  • 40
3
votes
1 answer

MUnit test fails when mocking external REST API call

I have the following Mule flow that is built to retrieve some details from an external API and then map this to some payload to return to the calling client:
danw
  • 1,608
  • 4
  • 29
  • 48
3
votes
2 answers

MulePollManager has disappeared from MUnit 1.0.0

We used the class org.mule.munit.MunitPollManager(in the munit-utils package) in older versions of MUnit to make sure that our poller did not start when the flow started, however this seems to have disappeared when Munit migrated to 1.0.0. How can…
user439407
  • 1,666
  • 2
  • 19
  • 40
3
votes
1 answer

Mocking spring beans in Munit

I am writing an MUnit test and would like to mock some of the beans used in my test but I have no idea how to inject them into the flow. Is this possible in MUnit?
user439407
  • 1,666
  • 2
  • 19
  • 40
2
votes
1 answer

How to raise a Custom Error With Internal payload (error.errorMessage.payload) in MUnit

A little description of the flow: I have a flow that is making an HTTP call to a REST Webservice. There are a couple of errors that we get as statusCode=500 but with different "errorCodes" inside the response body. This request connector is wrapped…
Harshank Bansal
  • 2,798
  • 2
  • 7
  • 22
2
votes
2 answers

How to get read a JSON string from a file in Mule 4

I'm trying to create an MUnit test that mocks an HTTP request by setting the payload to a JSON object that I have saved in a file. In Mule 3 I would have just done getResource('fileName.json').asString() and that worked just fine. In Mule 4 though,…
Drew Ingram
  • 75
  • 1
  • 9
2
votes
4 answers

Unable to create MUnit test or suite

When trying to create an MUnit test in Anypoint Studio by right clicking on a flow then selecting 'Create new text.xml Suite' I see the following dialog appear: This has the disadvantage of not offering any stack trace to follow, however, looking…
a.cayzer
  • 289
  • 4
  • 22
2
votes
3 answers

Munit Issue for SAP connector while working with maven,

Hi I am facing the below while running munit with maven code. I have a flow containing SAP connector, then done the munit for the flow and trying to run the munit with maven, getting the below exception, need help. [ERROR] Failed to shut down…
Ankit Prakash
  • 37
  • 1
  • 7
2
votes
4 answers

Why do I get a Runtime Exception Accessing the size of an ArrayList from MEL?

In Mulesoft I have an ArrayList stored as an outbound property with one element. It looks like this: But if I try to access the size of this array I get an error and can't figure out why: The error is [Error: object is not an instance of…
CamJohnson26
  • 1,119
  • 1
  • 15
  • 40
2
votes
2 answers

Mavenized Mule project but Munit test run is failing

I have an existing Mule project (which has MUnit's also) and now we are trying to mavenize this project. I have used Anypoint studio only to mavenize and project building is success and I am able to get target/test-classes and target/classes folder…
Deepak Verma
  • 446
  • 1
  • 6
  • 15
2
votes
2 answers

Set Inbound Properties for MUnit Flow Reference in Mulesoft for APIKit

I'm trying to test APIKit in MUnit. Originally I was using an http request within MUnit to call my flow and then APIKit would route the request to the proper subflow where my logic lives. Now I want to mock one of the elements of the subflow, so I'm…
CamJohnson26
  • 1,119
  • 1
  • 15
  • 40
2
votes
2 answers

How should we be organizing our mule imports in order to maximize loading efficiency and for modularity for munit testing?

We currently have our mule projects organized where we have our mule flows in several flow files. We find that this helps in allowing us to reuse flows. However, it has an added side-effect. By having dependencies amongst other flow files, we are…
jcb
  • 195
  • 1
  • 4
  • 20
2
votes
1 answer

MUnit test error in Anypoint Studio when project is using Maven

I am trying to introduce MUnit unit tests to an existing Mule project which is using Maven for builds and dependency management. However I am unable to run the tests visually through Mule Anypoint Studio, when I try to debug them I get the error:…
Rob Bird
  • 3,764
  • 2
  • 28
  • 38
2
votes
1 answer

How to attach file in Munit for functional test cases- Mule ESB

I need to do end to end (Functional Testing)testing via Munit. For that, I need to attach actual payload which is Image. How can I attach the image in Inbound message processor( Munit - Set Message, there is no option for attachment) or any other…
star
  • 1,493
  • 1
  • 28
  • 61
1
2 3
10 11