Should Csla 6 offer a package for another host - unit tests? #2704
Replies: 2 comments 3 replies
-
I love the idea! To your background thoughts, I've also experienced the same, what I would call "dogmatic" pushback, from other's about "unit" tests and Csla. But I've recently completed/delivered an AutomatedTest layer which directly tests my business object layer. I had trouble getting buy-in for this. Originally asked for it back in 2016, but finally got permission and now boss is in love. Now you'd have to pry this test layer from my CEOs cold dead hands :-) Having it is going to be the key for allowing us to release far more frequently and with far more confidence (i.e. cloud deployments)
So, we love testing AND Csla. Again, I love your idea. |
Beta Was this translation helpful? Give feedback.
-
Trackback to earlier discussions with Jason on this subject, for additional thoughts and context #1736 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
All of the work that @rockfordlhotka has done to change Csla over to be dependent upon DI for 6.0 might offer an opportunity - or possibly raise a need - for unit testing projects to be a more officially supported hosting environment for Csla.
I'm starting to wonder if there should be another nuget package that is intended to be referenced by test projects. Perhaps we might call it Csla.UnitTesting to fit existing nomenclature. I think what I have put into Csla.TestHelpers is the starting point for [indeed, the majority of the code required for] the specialist part of that package. Renaming Csla.TestHelpers and then bundling it into a nuget package along with Csla.dll is the sort of approach I have in mind.
What excites me most about the change to using DI is that we can make further inroads into dismissing the concerns that some people have about the effect of Csla on the testability of solutions that make use of it. I think Csla gets rejected by a lot of developers unnecessarily because of this worry - I've had quite a number of people tell me that Csla isn't 'modern' for this very reason.
As it happens, I've always felt this testability concern was a bit of a non-issue, because the way I use Csla the BOs themselves almost always don't need testing. The rules they run might, but they are separate classes these days. In addition, I think the layers above them probably don't need to have the BOs mocked out, if you have managed to abstract your data access in some way. Generally, I think people have been misled about what the unit is usually supposed to be in unit testing [spoiler: it's often not a single class, in isolation] and get frightened about testing against a higher layer without abstracting away the BOs - which the original factory method style of coding didn't easily support.
@swegele has raised the question in discussion #2687 about whether there should be samples of unit tests for systems that make use of Csla. I think that's a fair question - but it triggered this slightly meater question when I started to ponder it.
Beta Was this translation helpful? Give feedback.
All reactions