Friday, June 16, 2006
As the web layer and library layer gets more mature, we need to unit test more complex situations. For example, here is a test that I recently wanted to write: page X should be accessable to supervisor, supervisor is defined by having one or more users they supervise.

Right now, we seed our data for unit test by using webunit to drive web pages. This is very cumbersome because it can take a lot of time to write, prone to breaking (although also prone to inadvertant testing which is good), and against proper test driven principles using a layer to test the layer itself.

In addition, there's some data that simply cannot be seeded, for example results from other servers.

We knew about this limitation from the day we started, but it's unclear how to address this.

My latest thought:

I think we need to come up w/our own unit test language, library. For example I want to write this

new:user(mary) { set supervisors = new group(accounting) }
new:user(john) { groups = accounting }
system:statsServer { parameter:mockStatsServer }

By definition, this language is customized to sipxconfig, but maybe the syntax and constructs do not have to be.

Maybe spring w/it's near unlimited extensibility, and sophisticated AOP (support especically spring 2.0) will help here. Challenge with this approach is "resetting" the environment between each test. Spring has application-like events, maybe that's an approach. It's a language and constructs we already know.

Powered by Blogger