Tuesday, January 12, 2010

Test Automation. Duh.

I haven't done too much since the holidays and I was having a hard time focusing again and I finally realized why. My testing sucked.

While embedding the GroovyScriptEngine into JMXTerm I was writing unit tests for all of the new classes and updating old test classes where I was modifying existing behavior. This was all fine, but then when I went to try out my new embedded engine with test scripts I would start JMXTerm and try running the commands that the scripts would implement. Sometimes it would work, sometimes it wouldn't, but every time it was a real pain.

I finally realized that I needed higher level functional tests that simulated me typing at the command line in addition to the class level unit tests.

There is a method on the CommandCenter class where all of the arguments typed in to the command line or passed in through stdin are processed. I not have a set of static test utility methods that can take a command line and run them through the entire application. After execution the test methods verify that the output from the script matches some regular expression and that the boolean return value of the execute() method is as expected.

This was really easy to do but it didn't dawn on my that I needed more than just class level testing to make it all work. I spend a lot of time at work selling people on automation. I guess I need to yell at me too.

I don't do any more manual testing of the command line and I love it. Developing is way more fun when there isn't one really annoying step in your workflow. Anyway, back to actual work.

No comments:

Post a Comment