My last post was about the new feature Testbox Watch which is in the latest version of Command Box. I wrote that it was probably a good idea to have two CommandBox windows open but with CB, my IDE, Photoshop, my project site, XKCD etc, the number of windows open is adding up quickly.
For the last two years I've been using IntelliJ by JetBrains and recently discovered the concept of external tools but didn't really have one to use. I wondered if I could get rid of the "Testbox Watch" window in my previous post about that feature.
My Folder Set up:
root
runner.cfm
tests
test1.cfc
test2.cfc
testbox
After a couple of false starts, some working but kludgy starts involving running .boxr files I came upon the following solution.
Here is my package output from CommandBox:
package show
{
"dependencies":{
"testbox":"be"
},
"installPaths":{
"testbox":"testbox\\"
},
"testbox":{
"runner":"http://127.0.0.1:55938/tests/runner.cfm",
"verbose":"true",
}
}
In Intellij:
For the last two years I've been using IntelliJ by JetBrains and recently discovered the concept of external tools but didn't really have one to use. I wondered if I could get rid of the "Testbox Watch" window in my previous post about that feature.
My Folder Set up:
root
runner.cfm
tests
test1.cfc
test2.cfc
testbox
After a couple of false starts, some working but kludgy starts involving running .boxr files I came upon the following solution.
Here is my package output from CommandBox:
package show
{
"dependencies":{
"testbox":"be"
},
"installPaths":{
"testbox":"testbox\\"
},
"testbox":{
"runner":"http://127.0.0.1:55938/tests/runner.cfm",
"verbose":"true",
}
}
In Intellij:
- Go to File --> Setttings --> Tools --> External Tools
- Click on the green + at the top of the page to bring up the new tool window
- Give the tool a name.
- In the Program input, point to your instance of CommandBox (box.exe)
- In the Parameters type "testbox watch"
- In the working Directory you can either use the Insert Macro button and choose ModuleFileDir or just type $ModuleFileDir$. Disclaimer: The way that I set up my CF projects in IntelliJ is basically a vanilla Java project with one module.
- Click ok and go back to your project
- In the Tools --> External Tools you should see you new tool. Choose it.
- The console window will come up and start the Testbox Watch process.
Final Notes: This is very handy! It saves a window being open. Spares me Alt-Tabing through a window that is taking up space puts the results front and center in real time. From the Testbox Watch help menu in CommandBox is this note:
If you need more control over what tests run and their output, you can set additional options in your box.json which will be picked up automatically by "testbox run" whe[n] it fires.
server set testbox.verbose=false
server set testbox.labels=foo
server set testbox.testSuites=bar
This means that if you wanted to specifiy the runner to only run certain tests (like what you're working on that day) you can alter the box.json temporarily to be more focussed and periodically go back and run the full suite.
One other thing that came out of this is that you can also run .boxr files from the External Tools in IntelliJ which seems to be would open up more possibilities.
Comments
Post a Comment