Testing is a vital component when creating a Mendix application. We get a lot of questions about testing, and that’s why I’m going to show you three tools you can use to test your Mendix applications. And for those of you who may not realize that testing is critical – then we’ll cover that quickly too!
For more information about integrating Mendix with add-ons, take a look at the Application Test Suite, Application Performance Monitor, and the Application Quality Monitor.
Why do I need to test my applications?
This may seem like a simple question, but here are a couple of reasons why you should not release without first testing. Finding and fixing bugs when your application is in production is a lot more expensive and time-consuming. Solving issues in the early stages of development ensures a more stable product and prevents embarrassment that comes from complaining customers.
And remember, speeding up innovation means releasing more often, and faster. If you wish to maintain speed to market without significantly increasing the time spent on testing, than you need the right testing tools. Using automated tests is essential for maintainability and keeping productivity with Mendix application development constant.
Ok, you convinced me that I need to test my applications. So how do I go about doing this?
You need to first decide what you are going to test. While you ultimately should focus on the business functionality associated with your Mendix application, there are also other components to test (which I’ve listed below).
- Consider any external interfaces, like web services and/or app services. If these exist, you should create integration tests to test the integration between your application and these external interfaces.
- Consider any custom logic in the form of Microflows and create unit tests for the Microflows. But remember, creating and maintaining automated tests for every Microflow could be very time-consuming, so consider focusing on the most used and complex Microflows.
- Consider your user stories, and create acceptance tests based on whether the application functionality meets the specifications within each story.
But remember, you don’t have to test everything; there is, for example, no need to test the database code because this is handled by the Mendix platform.
Integration testing with SoapUI
Web services are the preferred way of integrating a Mendix application with external systems. To test these web services, you need to create integration tests. An integration test is designed to validate component integrations.
- Automatically creating sample requests you can use for testing
- Creating and managing all tests in a test suite
- Use of assertions (assertions are used to validate the message received by a TestStep during execution)
Learn more about testing web services in Mendix using SoapUI here.
Unit testing with the UnitTesting module
Unit testing lets you test small parts or components of an application using test scripts. You can use unit testing tools to specify alternative configuration and mock existing functionality and dependencies (like databases), to isolate the specific code you want to test.
To verify that your Microflows work as expected, you can create unit tests using the UnitTesting module that is available in the Mendix App Store. Using this module you can easily write, manage, and run unit tests. Want to know more about the UnitTesting module? Check out our how-to about testing Microflows using the UnitTesting module.
Tip: Don’t try to test everything. Instead, focus on the most used and complex Microflows.
Acceptance testing with Selenium IDE
Acceptance testing means that your application conforms to the required level of quality and functionality the client expects. A great way to define an acceptance test is by looking at the user stories in your project. These usually provides great input for deciding which tests you need to create.
Selenium IDE is a Firefox plug-in that allows you to create acceptance tests by navigating through your application while a plug-in records your actions. Benefits of Selenium IDE include:
- It’s easy to use for beginners
- You can edit recorded tests
- It’s extendable with Mendix specific extension
- You have the ability to export to various formats (e.g. Java, Ruby, Python)
Learn more about testing Mendix applications using Selenium IDE here. If you’re looking to create robust, browser-based tests, you should look into using a testing framework with Selenium. Find out which part of Selenium is appropriate for you.
The tools above have greatly helped me in my day-to-day work where I rigorously test Mendix applications to find the bugs before you guys do. Hopefully these ideas will also help you with your day-to-day work and your Mendix development!
Do you have any additions to improve testing or know any other good testing tools? Leave a comment!