Adding a Block Comment Keybinding to the ANT editor in Eclipse

Friday, December 2, 2011

If you’re like me, you keep your hands off the mouse and know your IDE intimately. You use shortcuts (keybindings) whenever possible, and if you find yourself reaching for the mouse, you stop and you try to find the shortcut.

Turns out, Eclipse’s ANT editor doesn’t seem to have a keybinding for inserting block comments (<!-- -->). Fortunately, if your Eclipse install has a plugin such as the WTP HTML editor  or ColdFusion Builder which includes a “Insert Block Comment” action, then you can easily bind that editor’s action to the ANT editor, thereby getting block comment insertion in ANT build files with a keyboard shortcut. Here’s how:

Binding a Block Comment to a keyboard shortcut

  1. Window – Preferences
  2. Filter on “keys” to get to the keybinding property sheet
  3. In the keybinding sheet, type “html comment” in the filter
  4. If your editor supports it, one or more  rows will appear. Highlight one of them.
  5. Click “Copy Command”
  6. In the copied command, down in the “Binding” field, type a keystroke you want to use. I like ctrl+shift+M
  7. In the “When” dropdown, select “Editing Ant Buildfiles”
  8. Click “OK” and get out of all that.

ant_keybinding

Now, when editing an ANT file, you can use your shortcut to insert block comments.

--Marc

MXUnit 2.1 Released

Saturday, November 12, 2011

We’re pleased to announce the release of MXUnit version 2.1, comprising contributions from long-time MXUnit developers and new contributors alike.

This version includes:

Test Decorators

Without doubt the most significant feature in this release is “Test Decorators”, largely contributed by Mark Mandel. Decorators let you change MXUnit’s default behavior by writing a bit of your own code, without having to change MXUnit’s internals. We’ll be bringing you more documentation on this soon, but in the meantime, some problems this will solve are:

  • --Being selective in which tests get run on which platforms
  • --Controlling the sort order of tests
  • --Adding auto-rollback functionality to tests which commit data to databases
  • --Controlling which functions in a TestCase get ignored
  • --Enabling you to use custom attributes on tests, and respond to those attributes in your decorators
  • And so on

The mechanics are thus:

  1. Write a new component which extends mxunit.framework.TestDecorator
  2. Override any of the functions in the base TestDecorator to achieve the functionality you desire
  3. Add that decorator to your testcase, like so: <cfcomponent mxunit:decorators=”My.Custom.Decorator”…>
  4. Optionally, use custom function attributes and respond to them: <cfset var someAttribute = getAnnotation(methodName, "myCoolAttribute")/>

See MXUnit’s built-in decorators for examples and ideas.

Array, Query, and Structure Comparisons

Another significant change is how MXUnit compares arrays, queries, and structs in equality assertions. Up till now, these were done via turning those datatypes into strings and doing string comparisons.

With MXUnit 2.1, you’ll get a full comparison of these datatypes. When mismatches occur, you’ll be able to see the full set of mismatches in both the Eclipse plugin and when running tests via the browser. When running from the plugin, you can either use the Compare Dialog to see the differences, or use MXUnit’s “debug” output to view a structure which explains all the differences. They look thusly:

CompareDialog

And

DebugOutputForComparisonFailures

This is a first stab at deep comparisons, and we expect that as you use them, you’ll identify areas for improvement. We always welcome patches and pull requests. It goes without saying that accompanying tests are required.

 

Test Ordering

Thanks to Ryan Anklam for contributing a long-overdue feature. Until now, test ordering was unpredictable. Ryan’s contribution will order tests in the order in which ColdFusion’s getMetadata() reports them. While still not deterministic – getMetadata() will not order tests exactly in the order they appear in the TestCase – it’s a welcome improvement over the current behavior.

In addition, with TestDecorators, it’s easy to get alphabetical ordering if you wish, since MXUnit ships with an Alphabetical ordering test decorator. See this example test for how to use it.

Special thanks to Tim and John Farrar for the conversations inspiring the TestDecorator feature, and to all who contributed bug reports, patches, and feature code to this release.

 

--Marc

CI with Jenkins, ANT, and MXUnit Presentation Materials from cf.Objective() 2011

Saturday, May 14, 2011

This year, I spoke at cf.Objective() on how to use the Jenkins Continuous Integration server for your ColdFusion projects. Slides and all code are available.

Test and be happy.

--marc

ORM Zen Presentation Materials from cf.Objective() 2011


At cf.Objective() 2011 I presented my story, in code, from suffering to (sort-of) ORM enlightenment. Slides, Code, etc are all available.

Thanks to all attendees!

--marc

Jenkins / Hudson Continuous Integration documentation now on the MXUnit Wiki

Saturday, April 2, 2011

Quite a while back, I wrote a series of blog posts detailing how to set up Continuous Integration with Hudson, ANT, and MXUnit for your ColdFusion projects. That documentation has now been updated for Jenkins and brought into the MXUnit Wiki.

Enjoy.

MXUnit Eclipse Plugin 1.4.1 Released

Wednesday, March 23, 2011

Thanks again to Denny Valliant for the latest updates to the MXUnit Eclipse plugin. This release includes two important features:

  • “Run as MXUnit Test” is now added to the “Run As” menu. This includes keybinding support, so you can now run your tests from keys. The default binding, following the Eclipse pattern, is Alt+Shift+X, M. You can change this to something more finger friendly in preferences.
  • Until now, when a test fails and shows you the list of files in the tag context, those files would only be openable if they existed in projects. No more. The plugin now supports opening the files from the file system if they are not in a project.

As always, the update site is at http://mxunit.org/update. Enjoy… And please thank Denny when you pass him in the halls!