How much effort do you put into designing your tests?

How much effort do you put into your tests? Is it enough for you to get XX% of code coverage, or do you aim for a higher purpose of some kind, like making sure all models / controllers / services are tested, disregarding all others?

I generally aim for 100% coverage of non-controller stuff where possible, and have recently started using Humbug to test the tests, but other than that, nothing too specific.

There is a lot of way of doing tests, so it depends. What if I use a tool, that hasn’t natively support for code coverage, like phpspec (I think, it doesn’t have). I personally, I will start with behat scenarios that are expressed in the ubiquitous language with no references to web/ui or other infrastructure details, and then use phpspec to drive out the domain models, which it may leads to an hexagonal architecture.
And after that just a couple of scenario to be implemented end to end and test some controllers and other integration with infrastructure concerns and in this way to achieve the test pyramid.
Or if the domain it based on domain events and leads to an cqrs/es architecture, then in case of the broadway framework I could use the scenario classes from the framework to do the testing of the overall flow from commands to events/read models. Or if don’t use a framework for this, and use a more relax solution then it might use again modelling by example bdd, but this is a little bit harder to implement, at lest for me.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.