Skip to main content

Command Box and Jet Brains IntelliJ

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:

  1. Go to File --> Setttings --> Tools --> External Tools
  2. Click on the green + at the top of the page to bring up the new tool window

  3. Give the tool a name. 
  4. In the Program input, point to your instance of CommandBox (box.exe)
  5. In the Parameters type "testbox watch"
  6. 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. 
  7. Click ok and go back to your project
  8. In the Tools --> External Tools you should see you new tool. Choose it. 
  9. The console window will come up and start the Testbox Watch process. 

  10. Opening and saving one of my test cfcs gave this output which was my tests being run.


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

Popular posts from this blog

Creating Stories and Tasks in Jira: Personas and our Software Development Team

Part of the CI/CD Development Series The next step is developing who is on our hypothetical development team. Given that it has a React front end and ColdFusion as the Server Side language, I came up with the following personas, all of which have their own needs and considerations for our development environment. I've listed all the jobs that need doing, not the people involved since, even on a small team or a team of one, these "hats" are all worn by someone, even if it's the same person. Personas for our Project Dev Ops Coordinator - The person responsible for smooth and accurate deployments CF Developer - The person responsible for the API and fulfillment code development and maintenance. React Developer - The person responsible for the front end development Database Coordinator - The person responsible for the schema, data, up time and, presumably the testing databases used by the developers. Lead Developer - The person responsible for coordinat...

CF: Scripting amidst the tags

Recently I had to do a quick "utility" page where I needed to see how many files from a directory listing had been recorded into a database. I've been writing about 98% of my CF code in script syntax but, since it was quick and easy, I did this quickly in tags because it was outputting directly to the browser. In doing so, I made an interesting discovery in that, when you use closures, even in tag based pages, you can write cfscript. Here's the example Get the directory listing:  < cfset alljs = directoryList(expandpath( '/src' ), true , "path" , "*.js" )> Get the database listings and convert it to an array < cfquery name = "alljsQ" datasource = "blah" > select * from sitefiles where filename like '%.js%' </ cfquery > < cfset recordedFiles = valuelist(alljsQ.filename).listToArray()> Use a filter function to weed out the files I'd already recorded < cfset missingFiles = alljs.fi...

As the Dev Ops Manager, I need to start planning our CI/CD release process

Part of the CI/CD Development Series Once we have our Deployment Diagram designed, we need to figure out out to get from here to there. If the end point is the appropriate server environment, the starting point is the developer with his/her hand on the keyboard. These steps take place on a variety of machines, within various process and can changes based on what files are checked in or not. At the moment, we've only created the early basics as seen below. The Beginning of our Deployment Activity Chart Even though there is quite a long way to go there are some elements which we have already been determined. For example We have determined the broad strokes of our technology stack. This is going to be React on the front end and ColdFusion on the server side. We have determined that we are going to be using linting on both the CF and React paths. CFLint for the CF and ESLint for the Javascript We have determined that we are going to be formatters - CFFormat for CF and...