I’m working on a really cool appender for Logbox which I plan on releasing to the community on Forgebox. However, I’m having a little difficulty writing tests, and getting things ready for publishing
My project structure looks like this currently (changed the names for simplicity):
I’d like to create a test harness so I can get jiggy with BDD, but I’m having difficulty getting started. I know I’ll need to create a test-harness folder with a self-contained app with its own box.json, but I’m not sure how to integrate
MyCoolAppender.cfc as a part of that app for testing because it lives in the root of the project folder and not in the test-harness folder.
Here’s what I tried so far:
To gain some inspiration, I took a look at the mementifier project to see how it handles testing. From what I can see, mementifier, has a subfolder called /test-harness/ which contains an instance of Coldbox with its own box.json. From what I can tell, this sub-folder is meant to be its own self-contained app that can be tested against. What’s confusing to me is how the test-harness app is even aware of the mementifier interceptor. This seems like a similar approach that I was going to take, but I must be missing something!
I know my project is a little different because the test-harness (or the end-user) wanting to use my appender will need to add it to the struct of appenders in the logbox section of /config/coldbox.cfc.
I scanned the Testbox documentation (https://testbox.ortusbooks.com/) and didn’t see much on how to write tests for submodules (or maybe I completely missed it).
If anyone has any tips or can point me in the right direction on how I can create a test-harness and configure it to use MyCoolAppender, it would be most appreciated.