Telrik JustMock与VSTS构建托管代理

时间:2017-08-04 11:06:38

标签: asp.net unit-testing telerik azure-pipelines justmock

我正在使用Telrik JustMock来模拟单元测试。在本地它运作良好,但当我尝试将其与基于Asp.net构建模板的VSTS构建集成时,它以错误结束。 错误的堆栈跟踪如下:

 Failed   ValidateNodeRegisteredReturnsTrue
2017-08-04T08:24:12.0452600Z Error Message:
2017-08-04T08:24:12.0452600Z    Assert.IsFalse failed. 
2017-08-04T08:24:12.0452600Z Stack Trace:
2017-08-04T08:24:12.0452600Z    at 

 xxx.UnitTests.TemplateManagerUnitTests.ValidateNodeRegisteredReturnsTrue() in d:\a\1\s\Dev\TSys Project\8. Unit 

测试\ XXX.WebMVC.Tests \ UnitTests \ ManagerUnitTests.cs:第36行

2017-08-04T08:24:12.0462606Z 
2017-08-04T08:24:12.0462606Z Failed   ValidateExtractPackageOnLocalServer
2017-08-04T08:24:12.0462606Z Error Message:
2017-08-04T08:24:12.0462606Z    Test method 
 xxx.UnitTests.ManagerUnitTests.ValidateExtractPackageOnLocalServer threw exception: 

2017-08-04T08:24:12.0462606Z Telerik.JustMock.Core.ElevatedMockingException: Cannot mock 'TemplateCreationService.TemplateUtility'. The profiler must be enabled to mock, arrange or execute the specified target.
2017-08-04T08:24:12.0462606Z Detected active third-party profilers:
2017-08-04T08:24:12.0462606Z * Visual Studio 2015 Code Coverage/IntelliTrace (from process environment)
2017-08-04T08:24:12.0462606Z Disable the profilers or link them from the JustMock configuration utility. Restart the test runner and, if necessary, Visual Studio after linking.
2017-08-04T08:24:12.0462606Z Stack Trace:
2017-08-04T08:24:12.0462606Z     at Telerik.JustMock.Core.ProfilerInterceptor.ThrowElevatedMockingException(MemberInfo member)
2017-08-04T08:24:12.0462606Z    at Telerik.JustMock.Core.MocksRepository.InterceptStatics(Type type, IEnumerable`1 mixins, IEnumerable`1 supplementaryBehaviors, IEnumerable`1 fallbackBehaviors, Boolean mockStaticConstructor)
2017-08-04T08:24:12.0462606Z    at Telerik.JustMock.MockBuilder.InterceptStatics(MocksRepository repository, Type type, Nullable`1 behavior, Boolean mockStaticConstructor)
2017-08-04T08:24:12.0462606Z    at Telerik.JustMock.Mock.<>c__DisplayClass34_0.<SetupStatic>b__0()
2017-08-04T08:24:12.0462606Z    at Telerik.JustMock.Core.ProfilerInterceptor.GuardInternal(Action guardedAction)
2017-08-04T08:24:12.0462606Z    at Telerik.JustMock.Mock.SetupStatic(Type staticType)
2017-08-04T08:24:12.0462606Z    at xxx.UnitTests.ManagerUnitTests.ValidateExtractPackageOnLocalServer() in d:\a\1\s\Dev\TSys Project\8. Unit Tests\xxx.WebMVC.Tests\ServiceUnitTests\ManagerUnitTests.cs:line 44

2017-08-04T08:24:12.0462606Z 
2017-08-04T08:24:12.0462606Z Error Message:
2017-08-04T08:24:12.0462606Z    Test method 
xxx.UnitTests.ManagerUnitTests.ShouldAssertCustomValueForDateTimeNow threw exception: 
2017-08-04T08:24:12.0462606Z Telerik.JustMock.Core.ElevatedMockingException: Cannot mock 'System.DateTime'. The profiler must be enabled to mock, arrange or execute the specified target.
2017-08-04T08:24:12.0462606Z Detected active third-party profilers:
2017-08-04T08:24:12.0462606Z * Visual Studio 2015 Code Coverage/IntelliTrace (from process environment)
2017-08-04T08:24:12.0462606Z Disable the profilers or link them from the JustMock configuration utility. Restart the test runner and, if necessary, Visual Studio after linking.
2017-08-04T08:24:12.0462606Z Stack Trace:
2017-08-04T08:24:12.0462606Z     at 

Telerik.JustMock.Core.ProfilerInterceptor.ThrowElevatedMockingException(MemberInfo member)     2017-08-04T08:24:12.0462606Z在Telerik.JustMock.Core.MocksRepository.InterceptStatics(Type type,IEnumerable 1 mixins, IEnumerable 1 supplementBehaviors,IEnumerable 1 fallbackBehaviors, Boolean mockStaticConstructor) 2017-08-04T08:24:12.0462606Z at Telerik.JustMock.MockBuilder.InterceptStatics(MocksRepository repository, Type type, Nullable 1 behavior,Boolean mockStaticConstructor)     2017-08-04T08:24:12.0462606Z在Telerik.JustMock.Core.MocksRepository.ConvertExpressionToCallPattern(Expression expr,CallPattern callPattern)     2017-08-04T08:24:12.0462606Z在Telerik.JustMock.Core.MocksRepository.Arrange [TMethodMock](表达式expr,Func 1 methodMockFactory) 2017-08-04T08:24:12.0462606Z at Telerik.JustMock.Mock.<>c__DisplayClass1_0 1.b__0()     2017-08-04T08:24:12.0462606Z在Telerik.JustMock.Core.ProfilerInterceptor.GuardInternal [T](Func 1 guardedAction) 2017-08-04T08:24:12.0462606Z at Telerik.JustMock.Mock.Arrange[TResult](Expression 1表达式)     2017-08-04T08:24:12.0462606Z at

 xxx.UnitTests.ManagerUnitTests.ShouldAssertCustomValueForDateTimeNow() in d:\a\1\s\Dev\TSys Project\8. Unit Tests\xxx.WebMVC.Tests\ServiceUnitTests\ManagerUnitTests.cs:line 57

 2017-08-04T08:24:12.0472600Z Failed   ShouldAssertCustomValueForDateTimeNow

如果有了Telrik JustMock与VSTS asp.net构建模板集成的知识,任何人都可以分享。

我能够在此处找到使用基于XAML的构建模板运行Telrik JustMock的链接: http://docs.telerik.com/help/justmock/integration-tfs-2013.html

我也在使用Asp.Net构建模板的Test Run任务。

1 个答案:

答案 0 :(得分:0)

基于处理"Profiler must be enabled" exception in JustMock文章,不允许免费版本使用分析器。另外,一个NuGet package for JustMock pr o。

的主题

您的服务器上需要setup a on-premise build agent安装了JustMock,并且此私有构建代理正在您的帐户下运行。

相关问题