Skip to main content

New Testbox Feature - Watch

This week, Brad Wood from Ortus Solutions posted a video to the company YouTube Channel (https://www.youtube.com/watch?v=7k2vXl8FQ24&feature=youtu.be)  about some of the new features in TestBox and CommandBox. One was the improved reporting with Testbox from CommandBox and some of the options involved. The other was a brand new feature for CommandBox itself and its integration with TestBox: Testbox Watch.

If you've never used watchers in other tools such as Grunt, the concept is simple. The program "watches" the files in the folder and, when one is changed, it responds in a pre-ordained way. This could be rendering it, running a script or, in this case, running your TestBox test suites.

1. To test it out you need to have the latest version of CommandBox.

  1. Open CommandBox
  2. type upgrade --latest
  3. You might get the message that you can't upgrade automatically but you will receive the URL to do it manually. 
  4. Install the latest version. 
  5. Open CommandBox to complete the install

2. Make an empty folder by typing "mkdir MyFolder" in CommandBox.

3. Install the latest version of testbox by typing "install Testbox@be" for the bleeding edge version.

4. One step that I think Brad skips in the video is to create a folder called tests in the root of your site and move /testbox/tests/runner.cfm into /tests. 
  1. mkdir tests
  2. cp testbox/tests/runner.cfm tests/runner.cfm

5. I then created two test cases in the /tests folder
  1. cd tests
  2. testbox create bdd test1
  3. testbox create bdd test2

6. Start the server and get the port for this instance. 
  1. server start
  2. Copy the URL from the open window

7. Set up your test runner in CommandBox.
  1. package set testbox.runner=http://127.0.0.1:55938/tests/runner.cfm (change the port to what actually is set).
  2. package set testbox.verbose=true (or false depending on your mood).
8. Try it from the browser: http://127.0.0.1:55938/tests/runner.cfm - success.

9. Try it from CommandBox.
  1. testbox run

Again, success. All tests failed (the default tests always fail on purpose so you don't forget to write them).

10. Now, try the watch feature
  1. testbox watch

     2. Edit one of the tests so it passes and save it.

Without having to do anything, the tests were re-run and the passing test shows up in green amidst all of the red text.

Ending Notes:
I almost always have a CommandBox window open these days. Using the watch command takes over the running CommandBox instance so you end up running two instances - one to watch and one to use. Make sure you keep them straight. I ran into a few errors when I started one site from window A and then re-started the same site in Window B. After that snafu, this set up worked well. 


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...

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...

As the Dev Ops Coordinator, I need to set up our git repo into several branches with the appropriate permissions for each one

Part of the CI/CD Development Series The core of every CI/CD process is the code repository whether it be Git, Mercurial, SVN or whatever. The general idea is that it allows multiple developers (or whomever) to access your code in the appropriate way in the appropriate level. This can either be the ability for anyone to pull an open source project but not write to the repo directly or full access to a developer on your team to create branches, push to master or anything that needs doing. For our project, we're using git although the hosting provider was up for discussion between Github, Bitbucket by Atlassian or CodeCommit on AWS. We decided to go with AWS for two reasons. 1. We are going use other tools in AWS as part of the build so we decided to keep it all together. 2. We needed to solidify the ins and outs of using IAM for the process. Basic Steps Create the Repo Create the branches we need Use IAM to apply the appropriate permissions to each branch and to set up ...