lundi 27 janvier 2020

Why does test method not complete in azure devops build pipeline, dotnet test task

I am running a dotnet test task in my azure devops build pipeline.

The test completes fine in Visual Studio (16.4.3) IDE on my machine, also using CLI with the "dotnet test" command.

However, in azure it fails. My solution is a .NET Core 3.1 API. The test returns a CreatedAtRouteResult type on a controller test. And I am asserting IsType<CreatedAtRouteResult>. Though in Azure it returns a ObjectResult and not the expected CreatedAtRouteResult. Additional info, test project is using xUnit and Moq. Though these frameworks are not related to the error.

I am not able to navigate to the build folder on the agents used in our private cloud.

Test code

Results from the test in Visual Studio and using dotnet test in CLI

Results from tests in Visual Studio

Developer CLI, using "dotnet test"

Test run for ...\SqlViewService.Tests\bin\Debug\netcoreapp3.1\SqlViewService.Tests.dll(.NETCoreApp,Version=v3.1) Microsoft (R) Test Execution Command Line Tool Version 16.3.0 Copyright (c) Microsoft Corporation. All rights reserved.

Starting test execution, please wait...

A total of 1 test files matched the specified pattern.

Test Run Successful. Total tests: 10 Passed: 10 Total time: 15,0151 Seconds

...\SqlViewService.Tests>

The error code from the azure build task:

Error message on dotnet test task in azure

I am following this link to setup the pipeline, though I am not using YAML but the GUI build pipeline tasks. Like so:

Test task

Publish looks like this:

Publish task

Test execution command line tool version is 16.3.0 in both azure task and locally.

Pretty basic setup, however cannot figure out where the mismatch appears. Do you have any idea or solution?

I have been looking into this article: https://docs.microsoft.com/en-us/azure/devops/pipelines/ecosystems/dotnet-core?view=azure-devops

Aucun commentaire:

Enregistrer un commentaire