Magnus Lidbom;17731 wrote:
I don't understand. That sounds self-contradictory to me. How can it be disabled for the code in the test project but not for the tests in the test project? The tests are the code in the test project :)
Sorry, perhaps I should have been clearer. Tests cover themselves in addition to your production code. You'll notice that if you turn off RDI for your test project, you won't be able to open the RDI scopes on any of the code in your test project. However, the code in your production project is still being captured by the tests and you'll notice you can open RDI scopes in it. To disable RDI for all of the code executed by the test, it needs to be done on the test itself and not in the settings for the project containing the test.
Quote:
I'm not willing to change the tolerances by over 1000%. That would make the tests meaningless. Is there really no way to get the tests Hard disabled without disabling RDI for the entire solution?
A 10x tolerance adjustment generally shouldn't be needed, but this does depend on the code involved. If you have a performance test that is thrashing a very CPU heavy algorithm (something like a sorting or compression routine), then the 'stub' instrumentation of RDI can still have a very big impact. For code like this, it might be better to use
inline directives to shut off RDI for the performance critical regions of code. When you use inline directives, NCrunch won't insert any RDI instrumentation for these sections of code at all.
It's worth noting that even without RDI, NCrunch's code coverage tracking also uses instrumentation and does have an impact on performance. It can likewise be disabled using
code coverage suppression comments.
Quote:
Just to be clear, I've disabled RDI for the entire performance tests projects via the ncrunch configuration, not individual tests.
I also did first try using [assembly:NCrunch.Framework.EnableRdi(false)], but that didn't work any better.
It may be worth trying to open RDI scopes for some of these tests (particularly in the performance critical parts of your code) to make sure its disabled. Maybe something is going wrong with the disabling. The Tests Window also has a tab that allows you to see how much data is collected for a test (Log Summary). If this tab is empty, it means RDI was successfully disabled for the test.
Quote:
I may well be missing something of the complexities involved, but given that NCrunch, to the best of my understanding, has a folder per test runner process, wouldn't it be possible to set up such folders that use only assemblies without RDI and use those for running the tests with RDI disabled?
Correct, and this is how it would need to be implemented. The complexities involved include a whole new dimension added to the internals of the engine, so that every project is built twice, instrumented twice, etc. The requirement is simple and logical. The implementation is probably months of development.