本文介绍了MSTest + Python单元测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Python unittest模块进行测试的Python项目.由于它已集成到Visual Studio中,因此可以通过VS测试框架完美运行(即,我可以异步运行所有测试.或者只需在测试资源管理器"中单击该漂亮的按钮并获得 有关测试结果的信息).问题是:如何通过MSTest运行此python单元测试.

I have a Python project for testing which uses Python unittest module. Since it has integration to Visual Studio, it works perfect through VS test framework (i.e. I can run all tests async. or just click on this beautiful buttons in Test Explorer and get information about tests results). Question is: How can I run this python unittests via MSTest. 

推荐答案

因此您可以在VS IDE的测试资源管理器"窗口中运行Pythod单元测试方法,对吗?

So you could run the Pythod unit test method in your Test Explorer window of VS IDE, am I right?

也许您可以使用一个驱动器向我分享一个简单的示例,所以我真的可以在我的身边运行它.

Maybe you could share me a simple sample using one drive, so I could really run it in my side.

但是我可以提供有关如何在命令行MSTest.exe中运行常规单元测试的详细步骤,如果可能的话,您可以使用以下步骤进行测试.

But I could provide the detailed steps about how we run a general unit test in command line MSTest.exe, if possible, you could test it using the following steps in your side.

(1)打开Visual Studio命令提示符.

(1) Open the Visual Studio command prompt.

(2)CD到项目的dll文件.

(2) CD to the project's dll file foder.

(3)像一个简单的示例一样运行测试:

(3) Run your test like a simple sample:

mstest /testcontainer:Yourproject.dll

然后所有测试方法都将运行.

Then all test methods will run.

如果可能的话,您可以按照详细步骤进行测试.

If possible, you could test it with the detailed steps.

参考:

https://msdn.microsoft.com/en-us/library/ms182489.aspx?f = 255& MSPPError = -2147217396

至少,我们知道是否可以使用命令行运行特定的单元测试.

At least, we could know that whether we could run the specific unit test using the command line.

最好的问候,

Jack


这篇关于MSTest + Python单元测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 02:13