Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to disable shadow copying with FakeItEasy & xUnit.net runner #355

Closed
exalted opened this issue Aug 30, 2014 · 8 comments
Closed

How to disable shadow copying with FakeItEasy & xUnit.net runner #355

exalted opened this issue Aug 30, 2014 · 8 comments

Comments

@exalted
Copy link

exalted commented Aug 30, 2014

Now I read about improving performance of tests if shadow copying is disabled, but to be honest I had no idea about the process before (nor do I now), yet I would like to ask for some guidance on how to "disable" shadow copying in development environment to have faster feedback with my tests.

It all begun while reading http://blairconrad.com/2014/03/06/limit-fakeiteasy-extension-scanning-with-a-bootstrapper/ and therefore #130, but have very little understanding about the matter.

Could you please explain?

Thank you.

@blairconrad
Copy link
Member

Hi, again, @exalted.

The first thing to note is that with modern releases of FakeItEasy, (1.19.0 and up) there's no particular FakeItEasy-induced performance penalty when shadow copies are used. Unless explicitly configured otherwise, using a custom Bootstrapper, the shadow copies will not even be looked at.

That being said, there is a small performance penalty for any application that uses shadow copies–the length of time taken to copy the assembly files. Usually this time is not so big. The numbers I reported when 1.19.0 was released were quite small, and that was for a very large project.

Still, you may find benefit in disabling shadow copies.
Of course, now we're down to a question about how to use xUnit.net. Which I don't. A quick search suggests that you can use a -noshadow argument.

@exalted
Copy link
Author

exalted commented Aug 30, 2014

@blairconrad thanks. I'm afraid I am not able to figure out how could I pass -noshadow parameter to xUnit.net runner for the Test Explorer in Visual Studio. Although I understand that's not your concern.

Having said that, I noticed that when I run all of the test together, there's always a single test that will take around a second or two (that doesn't do anything particularly slow) and the rest of the test suite will run in few milliseconds. I wonder if could that be realted to shadow copies and/or to FakeItEasy, somehow.

@blairconrad
Copy link
Member

Is the xUnit.net runner built in to Visual Studio, or is it a plugin? That may help you decide where to ask further questions. I know the MsBuild runner does allow you turn off the shadow copies...

@adamralph, you like xUnit, no? Do you know how to disable the shadow copies?

@exalted, if it's the first test that's taking extra time, I imagine it's due to shadow copies. Of course, FakeItEasy does do a little bit of setup the first time it's invoked as well. To help narrow it down, you could always put some timing information around the first FakeItEasy call. If it is the cause of the delay, you should see it whether you run 1 test or a thousand.

@exalted
Copy link
Author

exalted commented Aug 30, 2014

@blairconrad oh the timing is a neat idea! I expect the actual testing time to be much lower than what is actually reported by the test runner, correct?

Also, xUnit.net runner is an extension for Visual Studio that does integrates with the built-in Test Explorer.

@exalted
Copy link
Author

exalted commented Aug 30, 2014

@blairconrad I could also opt for disabling shadow copies for my entire development machine? Is it even recommended? (Say in machine.config or something.)

@blairconrad
Copy link
Member

Interestingly, it appears that there's a pull request to support disabling of shadow copying in the extension: xunit/visualstudio.xunit#9. It seems stalled, though.

I don't know how to disable shadow copies for a machine. It seems to be tied to the AppDomain. But I am not an expert.

@blairconrad
Copy link
Member

@exalted, there's xunit/visualstudio.xunit#10 as well. I didn't notice.

I guess you could checkout the source for one of those branches, build it and use that extension locally… or maybe ask @bradwilson or @onovotny about an estimated timeline/resolution of the PRs.

@exalted
Copy link
Author

exalted commented Sep 1, 2014

@blairconrad thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants