© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
1 reply
michalgrzyska

Testcontainers in integration tests vs BackgroundService

I have an issue with Testcontainers + WebApplicationFactory in integration test. I created my implementation of WebApplicationFactory implementing
IAsyncLifetime
IAsyncLifetime
from xUnit and I'm migrating my EF Core context in
InitializeAsync
InitializeAsync
method. However, it is probably too late - one of my background services tries to access in
StartAsync
StartAsync
(with ServiceProvider scope) db context to check some data and it results with an exception of "column ... does not exist". Is there any workaround for managing that problem?

code in comment
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

my docker testcontainers crash, so my integration tests fail marvelously
C#CC# / help
2w ago
Populating IOptions in integration tests
C#CC# / help
3mo ago
Integration testing with testcontainers and cosmosdb
C#CC# / help
2y ago
❔ WebApplicationFactory and integration tests
C#CC# / help
3y ago