Recently I.. kind of.. abused xunit for some software validation. Not really unit testing.
In order to make the process more understandable for the person who then has to click the „run all“ button, I decided that making tests
- run in alphabetical order (i. e. make test1 run before test2)
- make the order of the tests in the list match the order of execution
would be a good idea.
So.. I downloaded the source code, only to find out that.. yes, it is made for a lot of compatibility using .net 2.0, but.. the solution is in VS 2010. So.. on to my next PC, which has 2010 installed as well.
Long story short, after trying for a flexible solution for a while, not really seeing through the design (or not seeing a nice way to extend it the way I wanted), I simply hardcoded for the list to be ordered and also for the execution to be ordered. Both are independent by the way. So.. like I said, a design that I do not totally understand. But I don’t have to.
After changing some projects to .net 3.5 in order to get Linq and just do a few other minor changes, everything works fine. One of the changes was to make the list view not sorted..
Really nothing much more to say. If you have similar requirements, this might help you.
Oh, and.. through this, I found out that classes are stored in a nondeterministic way in assemblies – at least not determinable by me. (In 99% of all applications, this really does not matter.)
Together with the Priority fixture, this allows for some nice ordering in your tests. (Which you probably should not do for unit testing, but then.. having them run as similar as possible between 2 compiles also might be worth something.)
Feel free to use this under the original license.
- original link to xunit on codeplex
- Rar file with the xunit and xunit samples solution and release binaries, which is my changed code that displays and runs everything in a sorted way