Feature Suggestion - testbox run's runner as a relative path

Hey Guys,

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.

Thoughts?

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

Can you put in a ticket for this?

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

You know what they say, right? Great minds… :slight_smile:

I agree, omitting the HTTP is a good way to determine embedded server or not.

Where’s best place for ticket? Jira? https://ortussolutions.atlassian.net/browse/COMMANDBOX

Yep, that’s the place!

http://blog.coldbox.org/blog/how-to-create-a-jira-account-and-enter-coldbox-tickets

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Great here it is: https://ortussolutions.atlassian.net/browse/COMMANDBOX-184

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.

Brad,

Should the testbox.runner path be “/tests/runner.cfm” I get an error with “/test/runner.cfm”

Thanks,Ben

Are you doing “testbox run” or the “trick” I showed below. What error did you receive and what URL do you hit in your browser to run the tests?

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

I tried the trick below.

I get a “Page /test/runner.cfm” not found error.

Running version 00028

What URL do you load in your browser to run the tests?

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

When I run the “package show testbox.runner | server open” command it launches localhost:8090/test/runner.cfm

But if you create a coldbox app via command box the test folder is named “tests” not “test”.

Here is the entire process I’m doing just to make sure I’m not missing something with your trick.

  1. creating a folder called “mytestapp”
  2. CD into “mytestapp”
  3. run “coldbox create app name=“MyTestApp” installcoldbox=true installtestbox=true
  4. package set testbox.runner="/test/runner.cfm”
  5. package show testbox.runner | server open

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.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

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.

Thanks,
Ben

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.

I guess I had fallen prey to this. :wink:

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.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com