-
Notifications
You must be signed in to change notification settings - Fork 758
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
Web app not reachable externally(via browser/postman/curl,etc) rather than test code itself during test #2868
Comments
The test server which ASP.NET Core uses during integration testing runs in memory, not on TCP, so the server is not reachable externally (only via the client provided by the web app factory). |
If you're curious how it works: A fundamental interface for the HTTP pipeline in .NET is When integration testing, the ASP.NET Core team has opted instead to direct hook the server up to So this is why you can't hit your test server with a browser/curl/etc., because the test server doesn't put itself on the network at all. |
Before you file a bug...
I have a simple app with integration test with xunit.
Here is a sample code.
When running integration test, I am able to access api(Home/GetAll) and get result as required within test code. However, during process of running test, if I try to access same api externally i.e, using curl, postman, browser etc. the api is not accessible, saying failed to connect. I was wondering if a site is reachable within test code, then why I am unable to access it via browser or any other external tool.
I would like to know if api spin up in tests are restricted to being accessible to only test http client.
If there is some other configuration, that are needed to setup, then please feel free to guide me through.
Any example of integration test using xunit, whose site is up in browser as well while running test would be highly appreciated.
Thank you
The text was updated successfully, but these errors were encountered: