Unit Testing Business Logic

Unit Testing Business Logic

Old forum URL: forums.lhotka.net/forums/t/1358.aspx


JZuerlein posted on Friday, September 29, 2006

I've been working on writing unit tests for a business object and it feels like there should be a better way.....

I have an object called Review that represents an employee's annual review. It contains a state machine that decides what actions a user can perform on the object. The decision is based on internal object data, a supervisor hierarchy tree, role information in the identity object, and the history of actions that have been performed on the review.

Creating all the test objects in the scope of a transaction to verify the state machine works correctly is a nightmare. I created an identity "doubler" to ease the burden of creating identity objects for the assorted user personas, but that took a while, and it feels like I'm going to end up writing a lot of code to perform the tests.

I'm curious to find out what other people do to deal with this type of problem. Any suggestions?

Jeff

Copyright (c) Marimer LLC