C
C#2y ago
Davaaron

❔ E2E Test - Start MVC project

Hi, im using a testing tool for E2E testing and wondered how to get a MVC project started so the tool can visit the URL of the application and do some stuff? I call this in the constructor of the test class
OtherProjRefNs.Program.CreateWebHostBuilder(null)
.UseStartup<Startup>()
.Build()
.Start();
OtherProjRefNs.Program.CreateWebHostBuilder(null)
.UseStartup<Startup>()
.Build()
.Start();
but when I navigate to the URL within a browser after the Start() method, it says the page is not reachable. How can I start my MVC project?
6 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Davaaron
DavaaronOP2y ago
I see this (first attachment) when I open the page The network tab shows this (second attachment). I dont see errors in the output console or somewhere else. I reduced the call to
OtherProjRefNs.Program.CreateWebHostBuilder(null)
.UseStartup<Startup>()
OtherProjRefNs.Program.CreateWebHostBuilder(null)
.UseStartup<Startup>()
So it's going inside the ConfigureServices and Configure method, but it's too fast! I think the server is not started somehow.. when I debug the MVC project, it starts up correctly. Maybe the appsettings.json cannot be loaded, let's see I debug again
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Davaaron
DavaaronOP2y ago
I followed the IntegrationTest docs, as there was no E2E docs. I already tried the WebApplicationFactory but with the same results. The issue might be in my understanding of how it works, as it does not startup the whole MVC project, but I thought it would. We use Playwright in C# with XUnit. Unfortunately, there is no real documentation about that. Our idea was that the test could do start/shutdown the whole MVC project, so we dont have to start and shutdown the MVC project separately before and after all tests.
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server