-
-
Notifications
You must be signed in to change notification settings - Fork 388
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
Error using HttpTest with MSTest #207
Comments
Can you post the code for the test? |
I believe this code isn't even getting a chance to execute because the test runner is having issues with HttpTest. Just in case, this is how I am using the HttpTest object:
And using it in a test as such:
|
Have you tried a different test runner? I've never seen this so I suspect it's specific to MSTest. I can look into it but not until after the Flurl.Http 2.0 release. |
Do you have a stack trace? Without that I can't be of much help. It it seems that the MSTest runtime wants to serialize If that still doesn't work, try posting the question on Stack Overflow and maybe an MSTest expert will chime in. I'm using NUnit and ReSharper and I haven't encountered anything like this. |
Closing this issue. If you still need help, please ask on Stack Overflow. |
I have same issue with Nunit |
Just in case someone else hits this, I have the same issue. This is how we should be initializing HttpTest.
But since HttpTest doesn't have the [Serializable] attribute on the class, it's causing MSTest to fail. One solution is to move the HttpTest into [TestInitialize] and [TestCleanup] instead. Then MSTest won't have to try to serialize HttpTest between test cases.
|
@ZombiesWithCoffee @hrkeni @kenoma I'm willing to re-open this issue if any of you would be willing to help test it. Taking a fresh look at it, it's quite possible that all I need to do is add Here's what I'm asking for help with:
This would be tremendously helpful. Volunteers? |
Thanks @tmenier, but I'm going to say that it would be better to leave it as is. Since _httpTest.RespondWith only affects the next Flurl call, allowing HttpTest in the [ClassInitialize]/[ClassCleanup] would cause any secondary test to fail. The proper location for this is [TestInitialize]/[TestCleanup] |
This is how I'm now structuring my tests in MSTest/Visual Studio 2017
|
@ZombiesWithCoffee I agree completely, but who's using Can anyone repro this with |
Well, don't I feel stupid? But at least I can replicate his error. I'd be happy to test it out for you. |
I'm not getting anything in the link |
LOL, no problem. Looks like the link doesn't work publicly yet because the package is still in "validating" status. Been that way for 3+ hours. I contacted support, will update here when it's available. Thanks for your help! |
@ZombiesWithCoffee The prerelease is available, finally. |
Full version is released. Please re-open if this issue is not resolved. |
I'm trying to use Flurl.Http.Testing.HttpTest for some unit tests. Any time I try to run these tests I get the follow error:
An exception occurred while invoking executor 'executor://mstestadapter/v1': Type 'Flurl.Http.Testing.HttpTest' in assembly 'Flurl.Http, Version=1.2.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.
Any suggestions?
The text was updated successfully, but these errors were encountered: