简体   繁体   English

如何使用.NET代码以自动化方式运行Microsoft Visual Studio单元测试?

[英]How can I run Microsoft Visual Studio Units Tests in an automated way using .NET code?

We have a build and deployment tool and as part of the tool before a deployment I want to validate that all of our unit tests run. 我们有一个构建和部署工具,并且在部署之前作为工具的一部分,我想验证所有单元测试是否都在运行。 I want to execute the Visual Studio unit tests using C# code if possible in some way. 我想以某种方式使用C#代码执行Visual Studio单元测试。 These tests were not built for nunit. 这些测试不是为nunit构建的。 Are there any good articles or ways of doing this that someone could recommend? 是否有任何值得推荐的好文章或方法?

Team Foundation Server (TFS) can run all your test projects as a part of the check-in and build process. Team Foundation Server(TFS)可以在签入和构建过程的一部分中运行所有测试项目。 Check out this other question, Running unit tests on Team Foundation Server (TFS) builds . 找出另一个问题, 在Team Foundation Server(TFS)构建上运行单元测试

If you just want to run your tests from the command line, there is MSTest . 如果您只想从命令行运行测试,则可以使用MSTest

You can also run your VS Unit Tests if your using Team Foundation Server (TFS) and its build agents. 如果您使用Team Foundation Server(TFS)及其构建代理,则还可以运行VS单元测试。 However this may not be possible or even desirable for you. 但是,这对于您而言可能是不可能甚至不希望的。

The TeamCity build server now also has built-in support for running MSTests. 现在,TeamCity构建服务器还内置了对运行MSTests的支持。

暂无
暂无

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

相关问题 如何在 Visual Studio Code 中运行所有测试 - How to run all tests in Visual Studio Code 如何从MTM运行Ranorex自动化测试? - How can I run Ranorex automated tests from MTM? 如何在Visual Studio代码中运行.Net代码? - How to run .Net code in visual studio code? 如何使用不仅在visual studio上运行的其他工具运行vb.net文件? - How can I run a vb.net file using other tools not just running on visual studio? Visual Studio 2019 突然需要 nuget Microsoft.NET.Test.Sdk 来运行 xUnit 单元测试 - Visual Studio 2019 suddenly requires nuget Microsoft.NET.Test.Sdk to run xUnit unit-tests 如何在没有 Visual Studio 和源代码的情况下运行 NUnit 测试? - How to run NUnit tests without Visual Studio and Source code? 如何在 Azure DevOps 管道中运行 MongoDB 服务器和 Visual Studio 单元测试? - How can I run MongoDB server and visual studio unit tests in an Azure DevOps pipeline? Visual Studio 2008自动化测试项目可以读取诸如app.config之类的配置文件? (C#.NET) - A Visual Studio 2008 automated tests project can read a configuration file like app.config? (C# .NET) 如何在没有Visual Studio的情况下将ASP.NET Web应用程序项目作为虚拟主机运行? - How can I run ASP.NET Web Application project as a Virtual host , without Visual Studio? 如何在 Visual Studio 2019 中本地运行多个 Azure .net 5 函数项目? - How Can I run multiple Azure .net 5 Function Projects locally in Visual Studio 2019?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM