![](/img/trans.png)
[英]Getting multiple errors while running NUnit Test script on Azure Pipeline
[英]Azure pipeline not running NUnit tests
剛剛被介紹給Azure piplelines。 我的項目是一個.NET項目,並且與Azure鏈接在一起,但是在集成之前不運行我的單元測試(因此即使失敗的測試也要集成所有內容)
我的.yaml文件是:
# ASP.NET Core
# Build and test ASP.NET Core projects targeting .NET Core.
# Add steps that run tests, create a NuGet package, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
variables:
buildConfiguration: 'Release'
steps:
- script: dotnet build --configuration $(buildConfiguration)
displayName: 'dotnet build $(buildConfiguration)'
我的單元測試在解決方案下的MyProjectTests
項目和ProjectTests.cs
文件中。 誰能告訴我我需要添加到yaml文件中的內容(或一般情況下執行該操作),以便使其運行? 我本人對此進行了調查,似乎無法找到解決方案,並且我想避免因嘗試運行單元測試而失敗的提交歷史記錄被阻塞。
非常感謝。
更新:
我通過添加以下內容進行了修復:
- task: DotNetCoreCLI@2
inputs:
command: test
projects: '**/*Tests/*.csproj'
arguments: '--configuration $(buildConfiguration)'
干得好。
- task: DotNetCoreCLI@2
displayName: Test
inputs:
command: test
projects: 'PathToTestProject/TestProject.csproj'
arguments: '--configuration Debug'
當然,您可以選擇所需的任何配置。 並且displayName是可選的。 如果您的任何測試失敗,則管道將中止后續步驟。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.