【问题标题】:How can I run MongoDB server and visual studio unit tests in an Azure DevOps pipeline?如何在 Azure DevOps 管道中运行 MongoDB 服务器和 Visual Studio 单元测试?
【发布时间】:2020-10-05 04:08:05
【问题描述】:

我有一组使用 mongodb 执行的 Visual Studio 单元测试项目。

我想使用 Azure DevOps 管道运行测试,有人可以帮助我使用 YAML sn-p 吗? (我是 Azure 管道和 docker 的新手)

【问题讨论】:

  • 您有机会尝试以下答案吗?它是如何与您合作的?

标签: .net docker azure-devops


【解决方案1】:

如果您将来发布当前的 YAML 管道以获取更多上下文或可能的问题,将会有所帮助。

但这里是使用service container 的粗略管道;

resources:
  containers:
  - container: mongodb
    image: mongodb
    ports:
    - 27017:27017

services:
  mongodb: mongodb

steps:

#insert pre-test set-up steps here

- task: DotNetCoreCLI@2
  displayName: dotnet test
  inputs:
    command: test
    projects: **/*.Tests/*.csproj
    arguments: --configuration Release

您的集成测试应在连接字符串中使用主机值“mongodb:27017”。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-12-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-08
    • 2018-05-03
    • 2021-01-05
    相关资源
    最近更新 更多