Not sure if this is the best place for feature suggestions. I considered GitHub Issues or the project’s Jira Issues. I’d be happy to re-file accordingly. I also looked through to see if this had come up elsewhere but didn’t see anything.
I’d like to see “testbox run” run the box.json’s “testbox.runner” URLs as relative paths. Reason being is if I publish a package, and someone wants to pull it down and run it, the box JSON is configured for my local server and the random port number commandbox gave it. They would need to go and update their version of box.json with their own.
So how about on “testbox run” we check to see if there is a running server, if so, use the relative path from box.json to get there. If there is no running server, start one, then run with relative path.
Funny you sent this-- I’m literally writing the docs for testbox.runner right now and was thinking about the same thing. I think the trick is knowing whether the developer is using a CommandBox embedded server or some other server they’ve configured separately. We could say if it’s a relative URI (doesn’t start with “http” that it’s using the embedded server.
Here’s a little trick that will work if you’re on the bleeding edge of CommandBox:
package set testbox.runner="/test/runner.cfm"
package show testbox.runner | server open
I think as a common good practice is that anything that’s going to be publicly shared, like on ForgeBox, should use a relative URL and thus an embedded server. Not sure how that would be enforced, or even if it should be and it’s just good sense/common courtesy.
Lol, there’s no magic here, Ben. It’s just echoing out the same URI you input and you’re setting it to “test” not “tests”.
If your application has a folder called 'tests", then use that URI instead. The sample commands I typed in would certainly need to be adjusted for whatever your folder paths and runner names look like in your application. I just typed those commands into the E-mail from memory, so the usage of a folder named “test” was just purely coincidental.
Okay, I just wasn’t sure if I was getting some weird anomaly with how commandbox was creating the tests directory. Since your example had used “/test” I was thinking that the convention set was that it was supposed to create a folder called test.
Even in the testbox docs it always refers to a “test” folder but when using commandbox to create apps it has always created a “tests” folder.
I’ve always set my runner to point to where my tests folder is, but when you showed the trick to have the server open right to the test runners path I thought maybe there was a mapping created behind the scenes or something for test.
It’s one of those things where when one of the developers who builds the tools you use says “do something this way”, you tend to second guess yourself wondering if you’re doing something wrong.
We used to use a “test” folder convention so it’s just old habit I guess. I ColdBox 4 we turned model into models and test into tests to match views, handlers, interceptors, plugins, and layouts.