Unit Tests randomly fail
See original GitHub issueHi,
I am some issue with this module. It seems that when calling app.UseFastEndpoints();
Tests are randomly failing with Error:
The server has not been started or no web application was configured.
Culprit: Task.Run(async () => It seems that after 1 minute this static variables (discoveredEndpointDefinitions) gets set to null
I know that I am using Specflow/xUnit and that a the WebApplicaitonFactory is created for every scenario; I tried disabling the parallelism, but tests run too slow.
Why is the code doing that ? And could we make it configurable or be able to disable that behavior ?
Issue Analytics
- State:
- Created 2 years ago
- Comments:13 (13 by maintainers)
Top Results From Across the Web
jenkins - Unit tests sometimes failing, sometimes passing
Tests can fail intermittently for a number of reasons and identifying why they fail is often revealing about your codebase and environment.
Read more >How to Fix Flaky Tests - Semaphore CI
A test that intermittently fails for no apparent reason — or works in your local machine and fails with continuous integration — is...
Read more >Tests that sometimes fail
Unit tests also sometimes fail because of not cleaning up state properly, which only breaks things when tests run in a very specific...
Read more >Why The Tests Are Randomly Failing
There are three general reasons that “random” is causing tests to fail: (i) the randomly generated data is showing real errors in the...
Read more >Diagnosing Random Angular Test Failures
Understand that tests run in no particular order, and that is ideally what you want. Turn off random execution to help find the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok I’ll try
v2.11
; Yes this is throw by theTestHost
which is used byWAF
…When calling
CreateClient
(on theWAF
) it’s like the application never got created… or did not have time to finish creating.This article from Andrew Lock : Supporting integration tests with WebApplicationFactory in .NET 6 explain in quite a bit of details that might be of interest.
could you pls give
v2.11
a try with your setup. it might solve you problem if contetion was the actual cause. if not, you may still wanna look into temporarily disabling oldTestHost
s and running just WAF.