本文介绍了垫片无法在调试中与编码的UI测试一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在测试方法内部,如果该类使用[CodedUITest]装饰([TestClass]正常工作),则将委托分配给shimmed方法将引发ShimNotSupportedException.

Inside a test method, if the class is decorated with [CodedUITest] ([TestClass] works fine) assigning a delegate to a shimmed method throws a ShimNotSupportedException.

有什么想法吗?这是代码和堆栈跟踪:

Any thoughts? Here is the code and the stack trace:

用户代码未处理Microsoft.QualityTools.Testing.Fakes.Shims.ShimNotSupportedException

Microsoft.QualityTools.Testing.Fakes.Shims.ShimNotSupportedException was unhandled by user code

  HResult = -2146233088

  HResult=-2146233088

  Message = Pulse.Portal.Data.PortalContextWrapper

  Message=Pulse.Portal.Data.PortalContextWrapper

  Source = Microsoft.QualityTools.Testing.Fakes

  Source=Microsoft.QualityTools.Testing.Fakes

  StackTrace:

  StackTrace:

     在Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationRuntime.InvokeEvent [T](T值,动作1 eh)

       at Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationRuntime.InvokeEvent[T](T value, Action`1 eh)

     在Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationRuntime.OnAttachedUnsupportedMethod(MethodBase方法)

       at Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationRuntime.OnAttachedUnsupportedMethod(MethodBase method)

     在Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationRuntime.CheckInstrumentation(MethodBase方法)上

       at Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationRuntime.CheckInstrumentation(MethodBase method)

     在Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationRuntime.InternalAttachDetour(Object optionalReceiver,MethodBase method,Delegate detourDelegate)

       at Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationRuntime.InternalAttachDetour(Object optionalReceiver, MethodBase method, Delegate detourDelegate)

     在Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationRuntime.AttachDetour(Object optionalReceiver,MethodBase方法,委托detourDelegate)

       at Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationRuntime.AttachDetour(Object optionalReceiver, MethodBase method, Delegate detourDelegate)

     在Microsoft.QualityTools.Testing.Fakes.Shims.ShimRuntime.SetShimMethod(Delegate optionalStub,Object optionalReceiver,MethodBase方法)

       at Microsoft.QualityTools.Testing.Fakes.Shims.ShimRuntime.SetShimMethod(Delegate optionalStub, Object optionalReceiver, MethodBase method)

     在Microsoft.QualityTools.Testing.Fakes.Shims.ShimRuntime.SetShim(Delegate optionalStub,Type receiverType,Object optionalReceiver,字符串名称,ShimBinding标志,Type returnType,Type [] parameterTypes)

       at Microsoft.QualityTools.Testing.Fakes.Shims.ShimRuntime.SetShim(Delegate optionalStub, Type receiverType, Object optionalReceiver, String name, ShimBinding flags, Type returnType, Type[] parameterTypes)

     在Microsoft.QualityTools.Testing.Fakes.Shims.ShimRuntime.SetShimPublicInstance(Delegate optionalStub,Type receiverType,Object optionalReceiver,String name,Type returnType,Type [] parameterTypes)

       at Microsoft.QualityTools.Testing.Fakes.Shims.ShimRuntime.SetShimPublicInstance(Delegate optionalStub, Type receiverType, Object optionalReceiver, String name, Type returnType, Type[] parameterTypes)

     在c:\ SSDSS \ Pulse.Portal \ Pulse.Portal.Test \ obj \ Debug \ Fakes \ pp \ f.cs:line 0中的Pulse.Portal.Data.Fakes.ShimPortalContextWrapper.AllInstances.set_GetContext(Func`2 value)

       at Pulse.Portal.Data.Fakes.ShimPortalContextWrapper.AllInstances.set_GetContext(Func`2 value) in c:\SSDSS\Pulse.Portal\Pulse.Portal.Test\obj\Debug\Fakes\pp\f.cs:line 0

     在c:\ SSDSS \ Pulse.Portal \ Pulse.Portal.Test \ LoginTest.cs:第40行的Pulse.Portal.Test.LoginTest.LoginPassed()中

       at Pulse.Portal.Test.LoginTest.LoginPassed() in c:\SSDSS\Pulse.Portal\Pulse.Portal.Test\LoginTest.cs:line 40

  InnerException:

  InnerException:

推荐答案


这篇关于垫片无法在调试中与编码的UI测试一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 07:22