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
0
votes
2 answers

Mule Munit mock http.uri.params

i have a flow where using http I have a GET call where it hits a like like https://localhost:8081/ref/{ID} I know i can get this parameter in code by using mel like: #[message.inboundProperties.'http.uri.params'.ID] I need to mock the uri params…
ksmo92
  • 47
  • 1
  • 6
0
votes
1 answer

mocking SFTP using MUNIT

I have already seen the same question here, but the links provided in the answer are not working now. so seriously needed a solution for this issue. I have an SFTP setup in my mule flow along with a Database. I need to mock the SFTP and test my mule…
Pruthvi007
  • 52
  • 1
  • 1
  • 6
0
votes
2 answers

MUnit test fails - Cannot process event as “FileConnector” is stopped

I am implementing Munit for a flow which involves Mule Requester. This mule requester would be picking up a file. So, when i run the java class as Junit, it throws out an exception as, Cannot perform the operation on the FileConnector as it is…
0
votes
3 answers

Setting flow variables in MUnit with java

I am implementing MUnit with java for a mule flow. The flow is having a flow variable who's value is being derived from a variable in another flow. So, I need to have this value set in java which would be run as Junit. Please let me know how do we…
0
votes
2 answers

munit throw a specific exception

I am trying to throw a Filter Unaccepted Exception in munit to test my error handling but I am getting this error org.mule.api.MessagingException: Failed to invoke throw-an. at get_data_filter_unaccepted_exception-test.mock:throw-an{doc:name=Throw…
Dangson
  • 1
  • 1
  • 1
0
votes
1 answer

Munit mocking DB connector

I'm trying to write an integration test for a mule flow that retrieves a file from a JMS queue and inserts it into a DB. One test scenario is running through the exception flow when the DB is not available (connection error). For this test I want to…
Kristof W.
  • 43
  • 1
  • 7
0
votes
1 answer

Mocking Salesforce in MUnit in Mule

I need to mock the salesforce endpoint. So I need to have a payload returned from the mock processor that's mocking the salesforce. Currently I have written the MEL as follows…
0
votes
2 answers

Can you stop an MUnit test part way through a flow?

I am writing an MUnit test to test a sub-flow is called but once the sub-flow has been called the test tries to route through the rest of the flow. Without mocking various processors this means the test will fail. Is it possible to stop a test when…
a.cayzer
  • 289
  • 4
  • 22
0
votes
1 answer

How to convert comma separated data to CopyOnWriteArrayList to be sent as payload in MUnit

I am implementing MUnit for a flow where I need to send the payload through a Set Message Processor as a CopyOnWriteArrayList. The payload data would be fetched from a file. The file would have comma separated XML Data. I need this data to be sent…
0
votes
1 answer

Setting payload to http.query.params.variable_name during an MUnit test

I am trying to set up an MUnit test to confirm that the set payload method is setting the payload to the right value. I am sending in a JSON file via a HTTP endpoint. When running the flow normally setting the payload…
a.cayzer
  • 289
  • 4
  • 22
0
votes
2 answers

MUnit with SFTP component

Has anyone used MUnit with SFTP component, could yo please provide me any helpful information/example to start up? I went through the MUnit documentation but didnt get much help on the SFTP component with Munit.
user6284034
  • 37
  • 1
  • 8
0
votes
1 answer

Mulesoft MEL Expression Get String Value Of Payload Data Type

I want to extract my payload's class name in a MUnit assert so I can verify the payload is always of the correct type. I've tried 2 MEL expressions, but both return null in the MEL expression evaluator. The funny thing is that if I remove the .name…
CamJohnson26
  • 1,119
  • 1
  • 15
  • 40
0
votes
1 answer

Mocks not working in MUnit suite but they work when run test by test

I am using Munit to test my Mule Flow and I am using mocks to set the variables so that the flow doesn't throw an exception. When I run the test on it's own it passes but when I run my full suite just that test fails and running the debug shows that…
a.cayzer
  • 289
  • 4
  • 22
0
votes
1 answer

Mock an Exception in MUnit with Mulesoft

I have a flow containing an http request to an external service. I want to add an MUnit test to make sure the logic functions when the external service is down and returns a 500. I mock the http request and return a 500, but the flow does not raise…
CamJohnson26
  • 1,119
  • 1
  • 15
  • 40
0
votes
1 answer

Error while running Munit test flow

I am getting below error while just running MUnit Project I just started learning MUnit: Could not find or load main class org.mule.munit.runner.remote.MunitRemoteRunner
Ravi Hanok
  • 405
  • 1
  • 12
  • 23