How to use Junit to do unit testing?

1
Hello,   How can I write unit test cases for microflows and nanoflows using Junit.   What and how to proceed with Junit. There are no proper documentation available.   Please could anyone one you guide me how to do it... I am not understanding how to do it.   I have downloaded the Unit testing module but from there how to proceed?   Thank you.
asked
1 answers
1

You can use the Unit Testing module for testing.

 

To test a microflow, you need to create a new microflow prefixed with TEST_ (or UT_), for example TEST_Calculation. This microflow has the test inside and needs to return a boolean. This boolean should be true if the test passes, and false if not. You can't test frontend functionality, so it's best to break out testable functionality into sub-microflows.

 

Java actions can be tested with jUnit as you would for other Java classes. Just make sure the test is annotated with org.junit.Test.

 

To run the tests you need to make sure the UnitTestOverview is available somewhere in your navigation. This will automatically find all the microflows prefixed with TEST_ and make them available to run here. If you want to include Java tests, you need to set the UnitTesting.FindJUnitTests constant to true.

 

https://docs.mendix.com/appstore/modules/unit-testing/

 

I hope this helps.

answered