I wonder what you think about a probable design sh...
# testing
a
I wonder what you think about a probable design shortcoming in TestBox's SimpleReporter (ref: https://github.com/Ortus-Solutions/TestBox/blob/v4.5.0/system/reports/SimpleReporter.cfc#L71)
The design shortcoming is that
runReport
is a bit of a god method. It's clearly doing a bunch of different things (each comment denotes "a different thing"), which rather violates the Single Responsibility Principle, as well as probably the Open-closed Principle (ref: https://en.wikipedia.org/wiki/SOLID). What it should be doing is breaking each of those out into separate methods. Why? Because if I was to be wanting to extend SimpleReporter to change some of its behaviour, then I need to override that entire method. Even though - in my case - all I really want to do is to override a method that might be called
prepareReport
(or something like that... I derived that from the comment in the code I pointed to above). All I want to do is to use a different .cfm file for the mark-up, eg:
Copy code
// me.adamcameron.myApp.test.reports.SimpleReporter
component extends=testbox.system.reports.SimpleReporter {
    function prepareReport() {
        savecontent variable="local.report" {
            include "/some/different/path/here.cfm";
        }
        return local.report    
    }
}
All the config stuff the reporter does is spot-on for my requirements... I just need to tweak the output slightly. The general design advice that "if you are tempted to put a comment in your code to explain what happens next... then that next thing should be a function with a name that describes what the comment would be describing" exists for a reason.
l
I am open for enhancing pretty much everything my friend. Most of the time, 95% of the time, it's always me updating things. I get giddy when people contribute. and If we can make it easier and more flexible, I am all for it.
a
yeah I think last time I went to actually enhance something, I had some questions about [stuff] which didn't necessarily get answered, so I shelved the idea. This at least resulted in the
contributing.MD
getting created I guess.
l
We are working on new reporters and a new testing experience
once I have an alpha I will send it to you for feedback
a
I'm in the process of trying to work out WTF is going on with one or poss two Lucee bugs, and a CF bug stopping me from "proving" the Lucee bugs. Plus I think a new TestBox bug I found this afternoon. So I'm kinda over "participating" in other ppl's codebases ATM, if I'm honest
l
lol
I know how that feels
jumping from pond to pond
pull one thread, and get another thread
1
a
I will get details of the testbox thing to you if it turns out it's a thing. Just starting on that now.
l
and another thread
a
At least you're always pleased-seeming when I bring stuff to you. [cough]
l
jajaja
a
Good news: not a bug in TestBox. Must've been something dumb I was doing in my test or my mocking therein.