简体   繁体   English

从 azure devops 管道运行项目测试

[英]run project tests from azure devops pipeline

I have a solution with a project in VS2022 with some unit tests.我有一个带有一些单元测试的 VS2022 项目的解决方案。

To run the tests locally I just right click on the project and choose 'Run Tests'.要在本地运行测试,我只需右键单击项目并选择“运行测试”。 Any idea how can I do this in Azure Devops Pipeline?知道如何在 Azure Devops Pipeline 中执行此操作吗?

Thx.谢谢。

enter image description here在此处输入图像描述

It's going to depend whether or not your project is an SDK-styled project or not.这将取决于您的项目是否是 SDK 风格的项目。 If you don't know what that is, if you are targeting .NET 5 (as well as .NETCoreApp 3.0) or higher then it is.如果您不知道那是什么,如果您的目标是 .NET 5(以及 .NETCoreApp 3.0)或更高版本,那么它就是。

If it is not an SDK styled project, then you will need to use the VSTest@2 task in your yaml pipeline.如果它不是SDK 样式的项目,那么您将需要在 yaml 管道中使用VSTest@2任务。

If it is, then you just use then DotNetCoreCLI@2 task to run tests.如果是,那么您只需使用DotNetCoreCLI@2任务来运行测试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM