Development related to OOP testing

Recently, I began to study the development based on tests, namely MXUnit, and I like the idea of ​​this. I can understand the idea of ​​using TDD with stand-alone CFCs, but when it comes to using it with the basics of OOP, mainly FW / 1 and CFWheels, I'm not sure how to use MXUnit with the CFC framework (controllers in FW / 1 and models and controllers in CFWheels).

Does anyone know where I can find resources for using MXUnit with the Framework?

+4
source share
1 answer

I can only talk about F / W 1, since I did not use CFWheels (some information is in another SO question here ), but in my opinion unit testing can be simplified by using the service level correctly .

The idea is that you test service-level objects with MXUnit and leave the infrastructure controllers (like FW / 1) very light. In fact, controllers simply pass parameters to the service level, receiving a response back and displaying the view.

We believe that the structure is the least likely place where you introduce errors, so concentrate your testing on the service object, that is, on the main business logic of your application.

Interestingly, structures other than ColdFusion (such as Grails ) do not test the structure, tests ("domain classes" in grails that model the data) and your service objects are created for your model, but it is assumed that the structure works fine. The idea there - again - is to get the logic out of your controllers and test your service level and domain model.

I hope this helps.

+3
source

Source: https://habr.com/ru/post/1341471/


All Articles