【发布时间】:2017-05-04 09:28:10
【问题描述】:
我试图弄清楚如何在 Visual Studio 2015 中调试在 Docker 容器中执行的单元测试和集成测试。
我制作了一个 Dockerized 的 ASP.Net Core 1.1 应用程序,并通过 docker-compose.json 文件连接到 Postgresql 数据库。
我编写了一些单元和集成测试。集成测试针对数据库运行测试,所以我创建了一个 docker-compose.json 来:
- 启动数据库
- 编译代码
- 使用命令
docker test test/path-to-the-test-project/project.json启动测试
我使用 powershell 手动运行 docker-compose。一切都很好,但是通过阅读数千行日志来调试真的很痛苦。
那么,我们如何在 Visual Studio 中执行测试套件并调试测试代码,就像我们可以调试在 Docker 容器中运行的代码一样(并使用断点和其他调试工具)? (Debuging an ASP.Net Core app in a Docker container was explained in the Microsoft documentation)
【问题讨论】:
标签: visual-studio docker visual-studio-2015 asp.net-core integration-testing