Unit Testing for Mendix applications

1
Hi there, We have been looking into unit testing for our Mendix applications, but we are not sure if it is worth the time investment or not. Our applications has a lot of complicated "micro” flows at this point in time and for what we have seen, they seem hard to unit test. We have made a few unit tests on simple microflows and they seem to work. On the webs, I've also found that testing with a lot of API's is harder or not really possible. Big parts of the application uses API's, so this also adds up to our hesitations.  Now to our question: is unit testing for mendix worth it if the application has a lot of complicated microflows (many microflows in microflows, etc) or which uses a lot of API's to gather data? What are pro's and what are the con's?   Also, as for feedback on the unit tests. Is it possible to enable more than just "passed” or "failed”? We would like to have a better error message if the test would fail, so we know where to correct it.   I hope someone has more insight in this than we do. – Fern 
asked
2 answers
3

We use unit tests to check our logic on smaller microflows.

Most larger flows can be broken into smaller testable units and this can help give you confidence that your larger flows are working correctly.

When testing APIs you could break out the part that uses the response and create a series of tests that pass in dummy test data that simulates various response scenarios. 

As well as unit testing look at browser based testing such as ATS and Selenium. We use these to check the end to end process, mocking a user entering data and clicking buttons. 

Good luck!

answered
2

Hi Fern,

If it is worth to do unittesting heavily depends on the use case. In general the need for unittesting is lower than in high code applications, because a lot of issues you would normally do unittests for in high code are already covered by the platform. There is no need to unittest Mendix, only test the logic you created yourself.

In general: if you have a lot of complex business logic in microflows, it may be worth doing unittests on microflow level. The appstore has a unittesting component for this. Sometimes it is also enough to just create some testing logic yourself in the form of a microflow or grid that is present for testing purposes only.

Automated testing is also possible via ATS or selenium based systems like robotframework for example. This may require quite an effort and it also depends on the situation if that adds value.

I hope this helps.

answered