简体   繁体   English

在C#中执行/调试单元测试“方法”?

[英]execute/debug a unit test “method” in c#?

is there any way to execute/debug a unit test "method" in c#. 有什么方法可以执行/调试c#中的单元测试“方法”。 I m new to unit testing and there are lot of test methods in our file. 我是单元测试的新手,我们的文件中有很多测试方法。 I needed to test one among them. 我需要测试其中之一。

Just put a breakpoint inside the unit test method and then use Ctrl+R+T . 只需在单元测试方法中放置一个断点,然后使用Ctrl + R + T即可 This will run the unit test in debug mode and the breakpoint will be hit. 这将在调试模式下运行单元测试,并且将命中断点。 Alternatively to using the keyboard shortcut you could open the Test Explorer Window and then locate the unit test you want to run, right click on it and select Debug Unit Test. 除了使用键盘快捷键之外,您还可以打开Test Explorer窗口,然后找到要运行的单元测试,右键单击它并选择Debug Unit Test。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM