单元测试显示在“未运行测试"下.显然永远不会完成,但是可以通过"Debug Selected Test"来完成. [英] Unit Test is showing under "Not Run Tests" apparently never completes but fine via "Debug Selected Test"

查看:104
本文介绍了单元测试显示在“未运行测试"下.显然永远不会完成,但是可以通过"Debug Selected Test"来完成.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Microsoft Visual Sudio Professional C#2015下的同一模块中有两项测试.一项测试运行非常迅速,并显示在"Passed Tests(1)"下.但是第二次测试大约需要35-45秒(预期),但是从不显示为通过或失败 是否选择运行选定的测试"?或从播放列表或我能想到的任何其他机制运行.

I have two tests in the same module under Microsoft Visual Sudio Professional C# 2015. One runs very quickly and shows up under "Passed Tests(1)" but the second test, which takes about 35-45 seconds (expected) but never shows up as passed or failed whether I select "Run Selected Tests" or run from a playlist or any other mechanism I can think of. 

我得到的唯一输出是:

------开始运行测试------
===========运行测试完成:5次运行(0:00:45.7903509)==========

------ Run test started ------
========== Run test finished: 5 run (0:00:45.7903509) ==========

但是测试永远不会偏离不运行"状态.列表.

But the test never moves from the "Not Run" list.

系统如下:

Microsoft Visual Studio Professional 2015
版本14.0.23107.0 D14REL
Microsoft .NET Framework
版本4.6.00081

Microsoft Visual Studio Professional 2015
Version 14.0.23107.0 D14REL
Microsoft .NET Framework
Version 4.6.00081

如果我在2015年使用来运行它的话,它可以很好地完成工作.但是:当我在Visual Studio Premium 2013中运行它时,出现此错误:

It completes fine if I run it in the 2015 using. However: When I run it in Visual Studio Premium 2013 I get this error:

------开始运行测试------
调用执行程序'executor://mstestadapter/v1'时发生异常:成员'log4net.Util.PropertiesDictionary,log4net,Version = 1.2.13.0,Culture = neutral,PublicKeyToken = 669e0ddf0bb1aa2a'的类型未解析.
===========运行测试已完成:0运行(0:00:40.5175635)==========

------ Run test started ------
An exception occurred while invoking executor 'executor://mstestadapter/v1': Type is not resolved for member 'log4net.Util.PropertiesDictionary,log4net, Version=1.2.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a'.
========== Run test finished: 0 run (0:00:40.5175635) ==========

推荐答案

您好,AndreaRL,

Hi AndreaRL,

>> ,但第二项测试大约需要35-45秒(预期),但从不会显示为通过或失败 我是否选择运行选定的测试"或从播放列表或我能想到的任何其他机制运行.

>>but the second test, which takes about 35-45 seconds (expected) but never shows up as passed or failed whether I select "Run Selected Tests" or run from a playlist or any other mechanism I can think of. 

>> 如果我在2015年使用运行它,它可以很好地完成工作.但是:当我在Visual Studio Premium 2013中运行它时,出现此错误...

>>It completes fine if I run it in the 2015 using. However: When I run it in Visual Studio Premium 2013 I get this error...

很抱歉,我不确定您的测试是否在VS2015中正常运行,因为您说"Not Run Tests",但您也说"",如果我在VS2015中运行它可以很好地完成2015年使用". 有关此问题的更多详细信息?现在真正的问题是什么?

Sorry for that I'm not very sure that whether your tests run well in VS2015 as you said that "Not Run Tests", but you also said that "It completes fine if I run it in the 2015 using". Would you mind letting us know more detailed information about this issue? What is the real issue now?

您是说您的两个测试现在在VS2015中运行良好吗?但是您不能在VS2013高级版本中运行它们,对吗?

Do you mean that your two tests work well in VS2015 now? But you couldn't run them in VS2013 premium version, am I right?

>>调用执行程序'executor://mstestadapter/v1'时发生异常:成员'log4net.Util.PropertiesDictionary,log4net,Version = 1.2.13.0,Culture = neutral,PublicKeyToken = 669e0ddf0bb1aa2a'.

>>An exception occurred while invoking executor 'executor://mstestadapter/v1': Type is not resolved for member 'log4net.Util.PropertiesDictionary,log4net, Version=1.2.13.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a'.

也许您可以与我们分享这两种测试方法的主要代码,基于错误消息,我对此进行了一些研究,其中一个类似的线程添加了某些代码"CallContext . FreeNamedDataSlot方法" ; 在您的TestCleanup()中 这种情况下的方法.

Maybe you could share us the main code of your two test methods, based on the error message, I did some research about it, one similar thread which add certain code "CallContext.FreeNamedDataSlot Method" in your TestCleanup() method like this case.

http://stackoverflow.com/questions/23661372/log4net-logicalthreadcontext-and -unit-test-cases

CallContext.FreeNamedDataSlot("log4net.Util.LogicalThreadContextProperties");

最好的问候,

杰克


这篇关于单元测试显示在“未运行测试"下.显然永远不会完成,但是可以通过"Debug Selected Test"来完成.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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