Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Microsoft.AspNetCore.TestHost.TestServer returns 404
ramioh
#1 Posted : Monday, November 4, 2019 4:42:30 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 11/1/2019(UTC)
Posts: 2
Location: Egypt

Hi,

I have an integration test project with two tests that test an API project. The test project uses Microsoft.AspNetCore.TestHost.TestServer. When run in NCrunch, the two tests fail with a 404 when they try to invoke an endpoint in the API project.

The same two tests pass using VSTest.

I verified that the NCrunch workspace has the API assembly. When trying to "debug selected test in new task runner process", I verified that the Startup class and its ConfigureServices() and Configure() in the API assembly are hit, which means it is not a binding issue. It looks to me that the TestServer instance that gets created is fine. And the client that is created from it looks fine as well. (new HttpApiClient(_server.CreateClient(), null))

However, I still get a 404 when the client tries to [GET] a legitimate endpoint. Any ideas?
Remco
#2 Posted : Monday, November 4, 2019 7:07:11 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 5,830

Thanks: 754 times
Was thanked: 973 time(s) in 927 post(s)
Hi, thanks for posting!

Can you confirm that you're running the latest version of NCrunch?

Also, can you check whether compatibility mode makes any difference for you?

Are you able to create a sample solution that can reproduce the problem? You can submit code in ZIP form through the contact form.
ramioh
#3 Posted : Tuesday, November 5, 2019 7:36:26 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 11/1/2019(UTC)
Posts: 2
Location: Egypt

Hi!

Yes, I am running on 3.31.0.3.

This morning, I turned on the compatibility mode according to the article you cited. All project and solution settings were switched to the values in the "Suggested Value" column. Then, I disabled NCrunch, shutdown VS, deleted the workspace, deleted the _NCrunch_xyz folder, restarted VS, enabled NCrunch. The tests still fail.

About the sample solution, this will require some time to remove the business context out of the code. I hope I can do it tomorrow.

Thanks!
Rami
Remco
#4 Posted : Tuesday, November 5, 2019 11:10:03 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 5,830

Thanks: 754 times
Was thanked: 973 time(s) in 927 post(s)
ramioh;14008 wrote:

About the sample solution, this will require some time to remove the business context out of the code. I hope I can do it tomorrow.


Thanks! It looks as though I will need a sample to give further advice on how to resolve this problem. Sorry, I know it's a big ask, but I'll be blind without it.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.033 seconds.