-
Notifications
You must be signed in to change notification settings - Fork 182
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
Unable to run multiple test assemblies in a single app domain #189
Comments
Reproduced. I just added |
Running the tests using either one process per assembly or one AppDomain per assembly via NUnit are workarounds: I'm not saying this is a fix. I'd prefer not to tell users how to run their tests, but am not yet sure how to resolve this. The thrown exception has a nice message, but is otherwise indistinguishable from other exceptions that might arise from loading assemblies. As I suspected, the problem (at least when I reproduce it) occurs when we've already loaded an assembly in the current AppDomain and then we attempt to load a copy of the assembly from the current directory. As I sit here, I'm not sure what technical path we should take. Some things we can do:
@FakeItEasy/owners, any opinions? |
@alexjamesbrown, just to be clear, you're running tests from multiple assemblies, yes? I thought that was what we discussed. If you run tests all from the same assembly, you don't have this problem? |
@blairconrad thanks for the analysis!
|
Sounds like we're making progress! I think we should document it (for now) - It is indeed the cowards way out, Thanks for your help On 2 November 2013 12:44, Adam Ralph notifications@github.com wrote:
|
@alexjamesbrown agreed, documenting until it is fixed is a very good idea. Looking forward to your blog post! |
Haven't had the time to totally wrap my head around this, but I agree with what @adamralph says about option 2. In general, failing to load "extensions" or "plugins" should never crash. It should not throw an exception, it should either fail silently or possibly log to the console. That's my two cents! |
Good point, perhaps we don't need to bother trying to be clever with the exception at all then. Just throw into stdout and be done with it. |
Hi, @adamralph. I'm late to the party. Ran out of the house with this half-written this morning.
So, number 2 could be okay. I worry that people who get hit by this all the may be annoyed by the output, but I guess they'd have the option to workaround. Do we want to ship a 1.14.1 out quickly? I think I can find time to work on the fix later tonight/tomorrow morning. (Daylight savings ends tonight. Tomorrow has 25 hours!) Now we can wrangle over the error message! Oh, and unit/integration testing could be a pain. Hmm… |
Assuming this problem has been present for some time and given there is a workaround, I don't think there's any rush to hurry this out. As for the error message, I guess something straightforward like "Warning: Failed to load assembly 'C:\foo\bar.dll'" followed by the exception message. I imagine a unit test won't be possible for this fix. Perhaps there's a way to cobble together an integration/acceptance test though. |
Yeah, I'll try the cobbling. Not so sure about the message. I think that would leave unanswered questions. Then again, something reassuring may be too long. You may have noticed, but have a tendency to ramble on.
Then followed by the exception message? |
I like it! Much better. I presume we don't have to include the stacktrace? I guess people can debug their tests if they need to go down to that level. |
I think stack trace will add little or nothing... especially since the catch will be at a known place. And any FakeItEasy call could trigger the scan. I am inclined to skip it. |
Agreed. |
IFakeConfigurator has to do with the feature descrdibed here: http://ondevelopment.blogspot.se/2009/11/configuring-fake-objects-on-global.html |
Thanks. That'll help with #143, when I get back to it… |
@alexjamesbrown, I'm still working on a nicely-tested fix for this, but I do have an ad hoc FakeItEasy that contains what I expect will be very close to the fix. If you have time and interest, would you grab it and see if it makes your tests pass, even when run the old way? Thanks! |
Yeah, sounds good... |
It's in my dropbox. I put a link in the last comment. Let's see if this works better: https://www.dropbox.com/sh/u11tvi69s74jhe6/MAfbHD7x61 I don't often share this way. Tell me if you can't get and we'll make other arrangements. |
From SO post: http://stackoverflow.com/questions/19727000/unit-tests-failing-when-run-altogether-api-restriction-the-assembly-has-alrea
I've got a set of unit tests, which, if I run all together (using resharper) I get this error:
If I run them individually, they pass.
Further down in the exception, it's failing on lines like this:
[SetUp]
public void SetUp()
{
_myFake = A.Fake();
As we were discussing on Jabbr (https://jabbr.net/#/rooms/fakeiteasy)
If I run the tests in parallel, they pass
The text was updated successfully, but these errors were encountered: