Edit: It just occured to me that functions are likely called in the order in which they are declared in the class (as it only makes sense) so as long as create is defined before return, this should work fine - as my test has just proven to me. Not sure if there is a better way to explicitly call a function before another?
I can see why it's not typical to test trivial getter/setter methods but I have a CRUD class in which it wouldn't make sense to test the functions independently (some of them anyways).
When I write a test...I'm looking to test for failure and every path of execution...my create functions are pretty simple in that they work or they don't - if they fail it's likely caused by DB connection failure nothing else!!!
So what I usually do is actually test the retreival functions, by first creating a record, returning it's content, checking that content against data supplied when created and then deleting that record and trying retrieval again and testing for failure. I also typically through in some update code.
so a single test (using my own testing methods not a framework) would typically look like:
1) Create a record using known values
2) Retreive that record
3) Check for proper values or existance
4) Update that record with new values
5) Retreive again and test values
6) Delete record
7) Attempt to retreive record
Each function on it's own it really trivial to test as it either works or it doesn't...DB connections or invalid schema are the only thing i'm testing for...
Now, using lastcraft unit test, I figure I *could* write tests for each CRUD operation - telling me which function has an invalid schema...or I could use my own approach and write something of a super test (as described above) which tests all methods in a consecutive manner...
Obviously that approach is messy and difficult to maintain and is why I've finally decided to take a kick at using a framework...
So I ask, is there a way using lastcraft unit test to instruct the framework to execute functions in a particular order? I need known data in the DB to test retreival operations and having the testCreate() called before testRetrieve() would allow me to accomplish this without having to have to reproduce create code inside the retreival functions - do I make sense?
Cheers