My integration tests have dependency on redis. They have dockerfile included, so everything works in CI. However when running locally from test explorer I have to manually start redis container.
Is there possibility for IDE to automatically run/debug tests in docker containers, so when attemptying to run/debug test in IDE (or maybe even using dotnet test) everything runs in docker?
Please note, that I want to run/debug tests in docker, not docker in tests .
Seems like there is no solution to do so right now.
Here is ticket for rider: https://youtrack.jetbrains.com/issue/RIDER-38942 and for visual studio: https://developercommunity.visualstudio.com/t/allow-running-unit-tests-in-docker/554907
There are some hacks, which you can do to attach debugger to test project, but all of them require some manual interaction and experience is not as seamless as running/debugging the application.
Why not run the container manually?
Such a way you will get a working environment after the tests (all containers will be running).
For .NET development use Squadron . It orchestrate docker to spin up the container with given resource (Redis is supported) and clean up after test execution.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.