I did a quick timing of the two on the solution I'm currently working on. I'm using VS 2010 and TD.Net 3.0. I'm timing them manually by starting and stopping a stopwatch so this isn't completely accurate timings, but they give a good enough indication for me.
Full test suite
I did a fresh Get Latest and built the solution first. Then I ran all tests in the solution using TD.Net first and then the built-in VS runner afterwards. Here are the timings:
First run:
- TD.Net: 101 seconds
- VS: 143 seconds => 41% slower
Without changing anything I ran the same tests again. This time the results were more in line with each other:
Second run:
- TD.Net: 78 seconds
- VS: 85 seconds => 9% slower
I made a code change in one of the core-level projects on which most other projects depend, causing almost all projects to rebuild. After building successfully I ran both testers again, giving these results:
After rebuild:
- TD.Net: 86 seconds
- VS: 103 seconds => 20% slower
Single test class
It might not be a big deal that VS is a bit slower running the full test suite if you're doing TDD and most frequently run only the few tests covering the module you're working on. I therefore timed the performance of running a single test class only. As before I first ran TD.Net and then VS and timed them:
First run:
- TD.Net: 2-3 seconds
- VS: 8 seconds => +5 seconds, 166% slower
If you're actually doing some work you'll have made some code changes before running the tests again, so build time also contributes to the cycle time between tests. I know it's not possible to measure the build time since this varies wildly accross projects, but I wanted to see how this affected the times for my current project. I made a whitespace code change to the SUT and ran the same test again without building first:
After code change, including build time:
- TD.Net: 6 seconds
- VS: 11 seconds => +5 seconds, 83% slower
Conclusion
It's apparent that the VS runner is indeed slower that TD.Net. VS seems to use a lot more time in initialization. It seems to be about 20-40% slower for a full test run, and 80% slower for TDD.
Build times can affect your cycle time a lot more than the test runner, but with well factored modules the build time can be pretty low as you only need to rebuild the project under test and not the whole solution.
These tests were run on a codebase with relatively few tests compred to the amount of code (72 projects and 718 tests). I might have gotten different results if the number of tests matched the code size since initialization time might be more offset by the testing time.
It should be interesting to measure the timing difference between MSTest and another testing framework like N/Mb/XUnit as well.
No comments:
Post a Comment