Alright, so I’m using the Microsoft Test Framework for testing and I need to somehow build dependent tests. Why you might say? Because one of the tests ensures that I can load data from the database and the others need to operate against that set — making the round trips is something we don’t want to do to keep the automated nature of the tests efficient.
I have been searching and just can’t seem to find a way to do a couple of things:
- Decorate the test methods so that they are seen as dependent.
- Persist the set between tests.
What have I tried?
Well, regarding the decoration for dependent tests, not much because I can’t seem to find an attribute that’s built for that.
Regarding the persistence of the set, I’ve tried a private class variable and adding to the Properties of the test context. Both of those have resulted in the loss of the set between tests.
I hope that you can help me out here!
I think, what you need is an
orderer test list. You can create this in you test project under ‘New Item…’. The ordered test list is a list with tests in a specified order that are executed in the samecontext.By the way: Unit tests should test only the smallest unit in an application, not a huge set of operations. Because if one unit is not working correctly you can find easy wich one.