使用的PowerShell命令
1.创建项目相关命令
ls
mkdir
ni (new-item) 创建空文件
type 打开文件
dotnet new sln 创建空解决方案
dotnet sln add *.csproj 向解决方案添加项目
dotnet new classlib 创建程序集
dotnet new mstest (创建MSTest项目)
dotnet add reference *.csproj (当前程序集添加其他程序及引用)
2.执行测试相关命令
dotnet test 执行所有
测试
dotnet test --filter Method (执行完整名字包含Method 的测试方法)
dotnet test --filter Name~TestMethod1 (运行名称中包含TestMethod1的方法)
dotnet test --filter ClassName=MSTestNamespace.UnitTest1 (运行MSTestNamespace.UnitTest1类中的测试)
dotnet test --filter FullyQualifiedname!=MSTestNamespace.UnitTest1.TestMethod1 (运行MSTestNamespace.UnitTest1.TestMethod1之外所有测试)
dotnet test --filter TestCategory=CategoryA (运行含 [TestCategory("CategoryA")]
批注的测试。)
dotnet test --filter Priority=2 (运行含 [Priority(2)]
批注的测试。)
dotnet vstest <MyPublishedTests>.dll 对发布过的测试项目运行测试 (如果你的应用以 netcoreapp
之外的框架为目标,则仍然可以通过使用框架标志传入目标框架来运行 dotnet vstest
命令。 如:dotnet vstest <MyPublishedTests>.dll --Framework:".NETFramework,Version=v4.6")
原文地址:https://www.jb51.cc/netcore/622292.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。