Telerik.JustMock.dll!Telerik.JustMock.Core.Context.HierarchicalTestFrameworkContextResolver.CreateAttributeMatcher.AnonymousMethod__26 Normal
[External Code]
XXXXXXXX.Web.Application.dll!XXXXXXXX.Web.Application.Controllers.TransportController.Index() Line 44
XXXXXXXX.Tests.dll!XXXXXXTests.Transport.TransportControllerTests.IndexPageTest() Line 36
[External Code]
Telerik.JustMock.dll!Telerik.JustMock.Core.Context.HierarchicalTestFrameworkContextResolver.FindTestMethod Normal
[External Code]
XXXXXXXX.Web.Application.dll!XXXXXXXX.Web.Application.Controllers.TransportController.Index() Line 44
XXXXXXXX.Tests.dll!XXXXXXXX.Tests.Transport.TransportControllerTests.IndexPageTest() Line 36
[External Code]
11 Answers, 1 is accepted
Could you double-check that the test really hangs and is not just running excessively slowly? Please, check the CPU usage of the test runner while the test is running and get back to me.
If the test is maxing the CPU, then it's just running slowly, but should eventually finish. It is also possible that the particular set of arrangements you've made could be causing the to run in an endless loop. A minimal repro project would be really helpful to determine whether that's the case.
Either way, given these stack traces, I think it's impossible for the test runner to just hang there.
Regards,
Stefan
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
First thanks for the quick response. Secondly you are right, it's just slow. It took 23 minutes for the test to run, that's unacceptable. If I can find the time, I try to hobble together a minimal repro project to see if there are similar performance issues.
thanks.
bill
First thanks for the quick response.
Secondly, you're correct the process was just running slow, very slow. It took 23 minutes to run one test against a MVC Controller method, this is unacceptable. If I get the bandwidth, I'll try to cobble together a minimal reproduction project to see if it suffers similar performance woes.
Thanks
bill
Keep us posted with the performance results of your tests. Normally, the JustMock profiler slows down test execution by a factor of approximately 2.5x
Regards,
Stefan
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
I ran the test under JustTrace for about an hour, if I'm reading the profiler correctly, the test is spending a large amount of time in ProfilerInterceptor.Interrcept when called by Linq.Queryable.Count, does that sound right? I've attached a screen shot.
-bill
Hello Bill,
It appears that your test intercepts some very common method (47k intercepted invocations).
The number of calls to Count() and to Intercept() is disproportionate. It appears that a method in between the two visible calls is the culprit. Unfilter the Queryable.Count() node and check which is the call just before the Intercept call.
Regards,
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
Here is my Mock setup, is there a way to control what's Intercepted?
Mock.SetupStatic(typeof(UserProfileProvider), StaticConstructor.Mocked);
var userProfile = Mock.Create<Aramark.ISIS.Web.Application.Core.Providers.UserProfileProvider>();
Mock.Arrange(() => userProfile.Metrics).Returns(MetricProfiles());
Mock.Arrange(() => UserProfileProvider.GetUserProfile(Arg.IsAny<string>())).Returns((string x) => userProfile);
var httpResponse = Mock.Create<HttpResponse>();
var httpRequest = Mock.Create<HttpRequest>(Constructor.Mocked);
httpContext = Mock.Create<HttpContext>(Constructor.Mocked);
var contextCache = Mock.Create<System.Web.Caching.Cache>(Constructor.Mocked);
var httpResponseBase = Mock.Create<HttpResponseBase>();
var httpRequestBase = Mock.Create<HttpRequestBase>(Constructor.Mocked);
httpContextBase = Mock.Create<HttpContextBase>(Constructor.Mocked);
var user = Mock.Create<IPrincipal>();
var identity = Mock.Create<IIdentity>();
Mock.Arrange(() => contextCache.Get(Arg.IsAny<string>())).Returns((string x) => null);
Mock.Arrange(() => httpRequest.IsAuthenticated).Returns(true);
Mock.Arrange(() => httpContext.Request).Returns(httpRequest);
Mock.Arrange(() => httpContext.Response).Returns(httpResponse);
Mock.Arrange(() => httpContext.Cache).Returns(contextCache);
Mock.Arrange(() => httpContext.User).Returns(user);
Mock.Arrange(() => user.Identity).Returns(identity);
Mock.Arrange(() => identity.IsAuthenticated).Returns(true);
Mock.Arrange(() => identity.Name).Returns("csc");
Mock.Arrange(() => HttpContext.Current).Returns(httpContext);
Mock.Arrange(() => httpRequestBase.IsAuthenticated).Returns(true);
Mock.Arrange(() => httpContextBase.Request).Returns(httpRequestBase);
Mock.Arrange(() => httpContextBase.Response).Returns(httpResponseBase);
Mock.Arrange(() => httpContextBase.User).Returns(user);
I think the problem is solved! I added "Behavior.Loose" as a parameter to all the Mock.Create calls and now the test runs in 4 secs!
I'm glad that you've got the issue resolved. Still, for further reference I'd like to ask you to have a look at the profile that you took a few days ago and show me which is the method being intercepted so many times and in what context. It will further help us fine tune the interception process. If it is OK with you, I would like to ask you to send us the profile so that we can also investigate the underlying issue on our side. It is completely unexpected that the default RecursiveLoose behavior is penalizing the runtime performance so much.
Thank you for your time.
Regards,
Stefan
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
Send me an email address to send the profile.
bill
Please attach the profile to the ticket. That should be the easiest method for you. If that doesn't work then send the profile to JustMockPublicFeedback@telerik.com
Regards,
Stefan
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful Butt services to develop web, hybrid and native mobile apps.