A lot of 4D developers ask if we can write unit tests within 4D. Yes you can write unit test with 4D but there was no easy way to do it. You must create your own routine.
One component was existing long time ago, you can still find the source code for v12 here markschaake/UnitTester4D
If you look at the code, you will maybe, like me, be repeal by the complexity of the architecture. Well, it was done long time ago and without the object notation so I will not blame.
In 4D it is a little bit more complexe. You can write unit tests, and partial integration tests. But everything that touch the GUI is really complicated to do (not to say impossible). The only ones that I ever been able to see doing some GUI tests are the 4D Services with some specialists (you can find their service here : Quality Assurance Automation Services).
So, inspired by the RITEway test library written by Eric Elliot, I wanted to do something similar and as simple as it.
What Eric Elliot say's, is that some tests library fails to describe correctly a test. Here is what a test should have :
What is the unit under test (module, function, class, whatever)?
What should it do? (Prose description)
What was the actual output?
What was the expected output?
How do you reproduce the failure?
The description of a test is simple, here is a screen shot of a test with 2 assertions.
The component also have a main window to display the results :
I also want to share it freely to the 4D Community. You can find it in my company Github repository : AJARProject/AJ_Tools_UnitTest
You will also find the documentation.
Hope this component will be appreciated and help to write proper tests. If you have any questions, don't hesitate to ask me.
Also be sure to read those 2 article that inspired me to write this component. They also explain very well what are the different kind of tests :