Easier assertions for XML and JSON in MUnit

This is a guest blog from a member of our developer community. Dr. Roger Butenuth is a Senior Java Consultant at codecentric, he has been using Anypoint Platform for five years, with projects ranging from building simple SOAP routing/transformation to introducing the API-led approach to a Fortune 500 company.

Building Mule applications differs from coding in Java. Instead of typing all your code (with a lot of CTRL+space completion),

Testing with MuleSoft’s MUnit: Part 2

mulesoft munit testing

This tutorial continues from Part 1.

Mock is a feature provided by MUnit to mock the behavior of the message processor. Basically, MUnit replaces the actual behavior of message processor with the behavior defined by the user.

There are various scenarios where we can use the Mock Message processor. Imagine we have completed the development of a Mule application and need to test it,

Testing with MuleSoft’s MUnit: Part 1

mulesoft munit

Learn more about MUnit and learn more about how to test Mule.

MUnit is a Mule application testing framework which allows you to build automated tests for your Mule integrations and API’s. MUnit is very well integrated with Anypoint Studio.

Various features available with Mule MUnit:

  • Create and build Mule tests by writing Mule code.
  • Create and build Mule tests by writing Java code.

Refactoring MUnit: the Mule testing framework

A few years ago, a MuleSoft engineer had a vision. That vision: automated testing for Mule applications in Anypoint Studio. As this developer’s focus was building Mule applications to connect SaaS apps, a validation framework would significantly reduce development time and increase productivity across teams. More specifically, unit tests would allow this developer to mock dependencies, uncover problems early, refactor applications quickly, and provide agile documentation for other Muleys.

Man in the Mirror, Apple’s Security Flaw, and the Importance of Unit Testing

The “Man-in-the-Middle” attack is such a well-recognized security risk, with established solutions and preventative measures in place that when I first heard about the recent ruckus around the Apple security flaw, I thought Apple’s trouble was more legal in natural, maybe some sort of royalties dispute between iTunes and the Michael Jackson estate. Only later did I found out what all the fuss was about “in the middle”,

Releasing Faster using pipelines: lessons learned from the trenches

motif

You probably heard we have been moving into a faster release cadence with the new mountain ranges releases in this post and this one. For many Product Managers or Business Owners releasing faster could be the difference between success and failure. Being able to shorten the cycle between an idea and valuable user feedback enables new companies to understand better market needs and improve based on it. Releasing valuable software earlier is the sweet spot for Agile and Lean methodologies.

Making SFTP testing portable

motif

Our integration tests should be portable, meaning that if we shared our project, everyone would be able to run our tests on any platform without needing to install any framework or application. This is a very common issue when we test flows that have an SFTP outbound endpoint. In order to do an integration test of our flow, we need to start an SFTP server on our machine or use a public SFTP server, which implies adding network overhead to our tests.

Connector Callback Testing – Local

Testing using an external API can be a PITA, especially if the API uses any HTTP Callbacks or redirects such as OAuth or WebHooks. If your using any callback functionality like this then the Service Provider needs a way to callback your application and therefore be accessible to the public Internet.

When you start integrating these APIs, it’s much easier to work on your local development machine,

The Zen of UI Testing with Selenium, Hudson and Sauce Labs

Most people who write UIs don’t care about testing. You know why? Because it’s hard. So hard, they’d rather not even bother and test things manually. You have multiple browsers. You have multiple platforms. And worse, you have all these frameworks and toolkits which are difficult to test. I’ll pick on GWT here for a moment. It takes 20 seconds to start a test – let alone a server side component to interact with or the time it takes to run your test.

Error handling testing with Byteman

motif

Testing exception handling code is not always an easy task. You either need to setup the external conditions that cause the exception to be raised or generate mocks to get the same results.

A third option is using a bytecode injection tool like Byteman. Using Byteman scripting language you can insert custom behavior into the application code under test. The main use cases for Byteman are: