在bat文件中执行一个测试用例 [英] Execute a single test case in a bat file

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

问题描述

大家好,

我有一些测试用例:

[TestMethods]

[TestMethods]

  public void Test()

 public void Test()

{  this.UImap.test1();

{   this.UImap.test1();

this.UImap.test2();

this.UImap.test2();

this.UImap.test3();

this.UImap.test3();

this.UImap.test4(); }

this.UImap.test4(); }

我想创建一个bat文件来分别运行每个测试.  

I want to create a bat file to run each test separately.  

例如:test2()对test1()有依赖性.  现在我想创建一个bat文件以仅执行test2()或仅执行test3()等等.

For example: test2() has a dependency on test1().  Now I want to create a bat file to just execute test2() or just test3() or so on..

有人可以给我一个例子吗?

Can anyone give me an example to do this please?

非常感谢您的帮助.

推荐答案

您好PTCVMS,

Hi PTCVMS,

感谢您的发布.

恐怕不可能在一个方法中单独执行测试,我们只能基于一个方法运行测试,这意味着如果我们在测试方法中执行测试用例,它将执行所有的测试用例.属于这种方法.

I’m afraid it’s not possible to execute the tests inside a method separately, we can only run tests based on a method, which means if we execute the tests cases inside test method it will the execute all of the tests cases which belong to this method.

但是,您也可以根据需要将测试用例分配到不同的方法中,并使用MSTest分别运行这些方法.命令行如下所示:

However, you could distribute your tests cases into different methods and run these methods separately by using MSTest, if it’s also possible to meet your needs. The command line will look like this:

mstest.exe/testcontainer:testproject.dll/test:MethodTest1

您可以用自己的名字替换上面的 testproject MethodTest1 .祝你好运!

You could replace  testproject and MethodTest1 above with the name in your side.  Good luck! 

最好的问候,

奥斯卡


这篇关于在bat文件中执行一个测试用例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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