Developing a Vectorworks 2011 tool plug-in, TDD-style – Episode 0

In the epilogue of “Developing a Vectorworks 2011 plug-in object, TDD style”, I hinted at some not yet coherent thoughts on how to develop a Vectorworks plug-in tool test first. Creating some Vectorworks geometry test first was reasonably straightforward: Do all calculations in a separate model class and use the pre-calculated model to generate the Vectorworks geometry.

A Vectorworks tool is a more sophisticated problem for a small mind like yours truly: It interacts with the drawing in a series of clicks, objects may be tracked while tool is running etc. How do we capture this potentially rich interaction test-first? Before we tackle these questions, let’s describe the tool, code named “Red/Green Line Tool”:

As the name implies, it will collect two clicks in the document and draw a green line if the start- and endpoint of the line (the first & second “click”) are are on a 2D polygon. If the clicks aren’t on a 2D polygon, they should be ignored. To top things off, a red line should be drawn if the startpoint is located on a different 2D-polygon than the endpoint:


My goal is neither to cover all bases with the tests (I intend to leave those as an exercise for the reader 😉 nor to develop a shippable, fully Vectorworks-conform tool (my day job takes care of this desire), but to focus on these three questions:

  • How do I isolate the “interactiveness” of the tool in a testable class?
  • How do I isolate & test the creation of Vectorworks geometry?
  • How do the chosen tests drive the design & architecture of the code?

Tune in next week when you’ll hear Dr. Bob wondering about how to get this thing off the ground.

Episodes so far: