LightWave Testing

I’m a great believer in unit testing, and test-first development. Unfortunately, the concept of automated testing doesn’t sit especially well with developing LightWave plugins (as I am with Shaxam). This project is an attempt to answer that.

The requirements are:

  • Be able to launch Layout or Modeler from Ruby.
  • Cause the launched process to open a given model or scene that is specified per test.
  • Load a plugin file that is specified per test run.
  • Run the plugin on the loaded model or scene, and save the output to an output file that is specified per test.
  • Load the output back into Ruby for verification.
  • Ideally launch all of this over the network.

These parameters stem from what I’m trying to do with Shaxam. When the Shaxam plugin is run, it saves the current layer or scene to an XML file in XAML format. This simple one-in one-out path with XML at the end should make it an easy fit for Ruby’s unit test framework, but LightWave seems not to have been designed with this type of process in mind.

So far, I’ve worked out:

  • I can’t specify the plugin to load anywhere other than in LightWave’s config file, but that path can be specified on the command line. This means potentially generating a new config file for each run. Fine.
  • I can pass a scene filename to Layout on the command line. Fine.
  • I can pass an object filename to Modeler on the command line. Fine.
  • I don’t know how to trigger running the plugin once Layout or Modeler has loaded. I know that it’s possible to specify a plugin to run on startup, but as far as I can tell, it gets run before the scene is loaded. Not fine, but I may be wrong about that.

More investigation is needed.

I’ve already discovered that plugins which run on startup can’t have a space in their name, because that makes the option parser misfire.

Leave a Reply

Entries (RSS)