Category Archives: ide
MXUnit and Me
If you’ve been keeping up with my blog over the last couple months, then you already know that I’ve been experimenting with test driven development. I love the work flow, the way it makes me view my code, and the peace of mind…I just don’t know that it will pay off in my work environment. Hence the experimentation.
Most of my TDD dabbling up to this point has been done in Ruby. I’ve finally gotten around to messing around with some of the major ColdFusion testing frameworks: cfunit, cfcUnit and finally MXUnit.
After doing small projects with each of them, I’ve finally decided to settle down with MXUnit. It’s got decent docs, a nice work around for private methods, I dig the web interface, the eclipse plug-in is great and creating my own stubs for the generator was a snap!
In short: Two thumbs up!
Here’s my test. I’m still really new to this sort of thing, so I’d love feedback should you feel so inclined:
function Setup() { this.cfc = CreateObject( "component" , "BaseObject" ); this.cfc = this.cfc.init(); makePublic( this.cfc, "SetInstance" ); makePublic( this.cfc, "Set" ); makePublic( this.cfc, "Has" ); makePublic( this.cfc, "Get" ); makePublic( this.cfc, "OnMissingMethod" ); } function TestSetInstance() { var value = "a"; AssertEquals( value, this.cfc.SetInstance( value ) ); value = StructNew(); AssertEquals( value, this.cfc.SetInstance( value ) ); } function TestGetInstance() { var value = "a"; this.cfc.SetInstance( value ); AssertEquals( value, this.cfc.GetInstance() ); value = "b"; this.cfc.SetInstance( value ); AssertEquals( value, this.cfc.GetInstance() ); } function Testinit() { var value = "a"; this.cfc = this.cfc.init( value ); AssertEquals( value, this.cfc.GetInstance() ); this.cfc = this.cfc.init(); AssertEquals( StructNew(), this.cfc.GetInstance() ); } function TestSet() { var field = "a"; var value = "1"; AssertEquals( value, this.cfc.Set( field, value ) ); field = "w"; value = "2"; AssertEquals( value, this.cfc.Set( field, value ) ); } function TestHas() { var field = "a"; var value = "1"; AssertEquals( false, this.cfc.Has( field ) ); this.cfc.Set( field, value ); AssertEquals( true, this.cfc.Has( field ) ); field = "w"; value = "2"; AssertEquals( false, this.cfc.Has( field ) ); } function TestGet() { var field = "a"; var value = "1"; this.cfc.Set( field, value ); AssertEquals( value, this.cfc.Get( field ) ); field = "w"; value = "2"; this.cfc.Set( field, value ); AssertEquals( value, this.cfc.Get( field ) ); } function OnMissingMethod() { var value = "a"; AssertEquals( value, this.cfc.SetSomething( value ) ); AssertEquals( value, this.cfc.GetSomething() ); }
Click to download the component I’m testing and the file above. Now.
Ruby Line Formatting
I wrote a little utility to turn something like this
this=that, something_else="something else entirely"
Into the much easier to read
this = that, something_else = "something else entirely"
I use it in conjunction with my clipboard utility so I can just copy, run, paste. I mostly use this when I’m working with ColdFusion, so it also works for those pesky cfsets.
Usage: (After copying your target text to your clipboard)
ruby clipboard_format_set.rb
PS: I’d love to set some of my scripts up as Eclipse shortcuts so I’ve been toying with the idea of writing an Eclipse plug-in to act as a proxy. I realize you can set up and run “External Tools”, but I have yet to see a way to bind a key. I’d like the plug-in to take care of the “pasting” to save me that extra ctrl-v. Maybe this would make a good New Years Project?
Ganymede JSEclipse Alternatives
I’ve been having memory issues since setting up JSEclipse on eclipse. I tried googling around first but had a hard time finding any plugins that supported Ganymede.
Once again, stackoverflow came to my rescue by suggesting (free for non-commercial use) Spket and while I haven’t used it extensively yet it’s been working great so far!
CFEclipse/Ganymede Line Number Problem
My tray line numbers weren’t showing up in CFEclipse since upgrading to the Ganymede version of eclipse. My preferences were set correctly. I did a bit of googling but I didn’t actually find the solution until a few links down, so I thought I’d share the link love!
1. In directory
[workspace]/.metadata/.plugins/.org.eclipse.core.runtime/.settings/
2. Edit (or create) a text file called
.org.cfeclipse.cfml.pref
3. Add the following line:
lineNumberRuler=true
4. Restart Eclipse
How to Recover a Deleted File in Eclipse
I don’t know how (yet) and I can’t recreate it, but I swear that Eclipse ate two of my files while in the CFEclipse perspective. Neither of which I had placed under version-control yet. (DOH!) I was able to recover one of them from a nightly back-up.
When trying to figure out exactly what the heck happened, I took a peek at the local history for my back-up file and Eclipse still had the record of my changes up to the moment I lost the file!
Sooooo I re-created my lost file, right-clicked “Compare With” and “Local History” and I was able to re-cover the latest version of my file!
Phew!
Thoughts on Bolt
As anyone subscribing to MXNA has heard en masse today, the big news ’round the CF Circuit is the announcement of a ColdFusion “development tool” affectionately titled Bolt. (Although Adobe does has a habit of changing titles on us)
Here’s what I’m on about.
1. Will it run on Linux?
This is a requirement for me. Since it’s an “Eclipse based development tool” I assume it will, but I’d like to see it asserted. I don’t mind paying a reasonable sum, but not if I have to wine or vm it.
2. Is it a plug-in or an IDE?
I hope by “development tool”, they mean plug-in. At the time of this writing there are 1101 plug-ins listed on eclipseplugincentral.com and I’d like to be able to use any and all of them if I so choose. If I want to run Spket instead of JSEclipse, I don’t want any grief about it. Also, I like having an agnostic editor. I want one IDE to rule them all. Chances are that if I have to keep eclipse around for my other languages then I’ll probably going to just stick with it.
3. Bloat-i-ness?
I’m a little worried about Bolt being tacked onto eclipse along with a laundry list of exciting! new! features! that I won’t use past the first week, but making for great upper-management selling points. I’m drowning in features as it is. This wouldn’t be such a big deal except that I’ve noticed eclipse can be a memory hog. I know it’s not an accurate measurement but it irritates me when I pop open the task manager on my windows box and see eclipse running well into the hundreds of megs, especially when e does most of what I want with a fraction of the memory and cpu usage.
All I really need out of an IDE is multi language and OS support, code-highlighting, snippets, RDS, auto-tabbing and intellisense. I signed up for the beta; if you can do this better than Eclipse, Adobe, I’m all yours.
Eclipse RDS Problem: Contacting Server…
I’ve been successfully running CFEclipse on Ganymede for a week or two now, but I finally got around to just installing and setting up my ColdFusion 8 Eclipse Extensions (downloaded from the lovely coldfusionportal.org). Everything looked like it went well: “Test Connection” worked. But whenever I would double-click a folder in my RDS Fileview or Dataview I would get hung up on this “Contacting Server…”.
It took a bit of googling, but I finally stumbled upon this post and I wanted to share the link love: http://www.vintagecoding.com/blog/2008/07/24/eclipse-rds-might-be-a-problem-with-ganymede/
Apparently if you click the arrow icon’s in the RDS Fileview and RDS Dataview views it’ll work. It’s a workaround alright, but it works.