如何从MSTEST运行单个测试用例 [英] How to run a single test case from MSTEST

查看:113
本文介绍了如何从MSTEST运行单个测试用例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MStest运行单个测试用例,但找不到正确的命令

I am using MStest to run a single test case but could not find a correct command

我尝试过:

1) mstest.exe/testcontainer:testproject.dll/test:MethodTest1 这将从名称MethodTest1开始运行所有测试用例.我还有其他测试名称,例如MethodTest100,MethodTest101

1)mstest.exe /testcontainer:testproject.dll /test:MethodTest1 This run all the test case starting from name MethodTest1. I have other test name Like MethodTest100, MethodTest101

2) mstest.exe/testcontainer:testproject.dll/test:MethodTest1/unique 这需要传递测试名称空间名称和测试类名称.

2)mstest.exe /testcontainer:testproject.dll /test:MethodTest1 /unique This needs to pass Test Namespace name and Test Class name.

当我执行以下命令时有效,但是我只能访问测试方法,而不能进行类或命名操作 mstest.exe/testcontainer:testproject.dll/test:TestNamespace.TestClass MethodTest1/unique

It works when i execute following but i have only access to Test Method not to class or namepsace mstest.exe /testcontainer:testproject.dll /test:TestNamespace.TestClass MethodTest1 /unique

如果有人可以在不使用TestMethod所在的Class Name或Name步调的情况下,以确切的命令帮助我运行单个测试用例,我将不胜感激.

I would appreciate if somebody could help me in exact command to run a single test case without using Class Name or Name pace in which TestMethod Lies.

谢谢

推荐答案

要在给定的类或名称空间下运行多个测试,可以使用通配符*.

For running multiple tests under a given class or namespace, you can use a wild card *. 

因此,运行:

mstest.exe/testcontainer:testproject.dll/test:TestNamespace.TestClass.*

mstest.exe /testcontainer:testproject.dll /test:TestNamespace.TestClass.*

将起作用

这篇关于如何从MSTEST运行单个测试用例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆