Profiling a Test which uses JustMock

4 posts, 1 answers
  1. Bill
    Bill avatar
    13 posts
    Member since:
    Apr 2014

    Posted 25 Jul 2014 Link to this post

    I'm using Visual Studio 2013. 

    I've configured JustMock to "run together with JustMock" all detected profilers, however I'm seeing this exception:

    Test Name: IndexPageTest
    Test FullName: XXXXXXX.XXXX.Tests.Transport.TransportControllerTests.IndexPageTest
    Test Source: c:\XXXXXXXXXXX\XXXXXweb\User Interface\Tests\Transport\TransportControllerTests.cs : line 24
    Test Outcome: Failed
    Test Duration: 0:00:00

    Result Message: Unable to create instance of class XXXXXXX.XXXX.Tests.Transport.TransportControllerTests. 
    Error: Telerik.JustMock.Core.ElevatedMockingException: Cannot mock 'XXXXXXX.XXXX.Web.Application.Core.Providers.UserProfileProvider'. 
    The profiler must be enabled to mock, arrange or execute the specified target.
    Detected active third-party profilers:
    * {B61B010D-1035-48A9-9833-32C2A2CDC294} (from process environment)
    Disable the profilers or link them from the JustMock configuration utility. Restart Visual Studio and/or the test runner after linking..
    Result StackTrace:
    at Telerik.JustMock.Core.ProfilerInterceptor.ThrowElevatedMockingException(MemberInfo member)
       at Telerik.JustMock.Core.MocksRepository.InterceptStatics(Type type, IEnumerable`1 mixins, IEnumerable`1 supplementaryBehaviors, IEnumerable`1 fallbackBehaviors, Boolean mockStaticConstructor)
       at Telerik.JustMock.MockBuilder.InterceptStatics(MocksRepository repository, Type type, Nullable`1 behavior, Boolean mockStaticConstructor)
       at Telerik.JustMock.Mock.<>c__DisplayClass67.<SetupStatic>b__66()
       at Telerik.JustMock.Core.ProfilerInterceptor.GuardInternal(Action guardedAction)
       at Telerik.JustMock.Mock.SetupStatic(Type staticType, StaticConstructor staticConstructor)
       at XXXXXXX.XXXX.Tests.Common.ControllerTestBase..ctor() in c:\XXXXXXXXXXX\XXXXXweb\User Interface\Tests\Patient\TransportTest.cs:line 75
       at XXXXXXX.XXXX.Tests.Transport.TransportControllerTests..ctor()


    Help!

    Thanks in advance,
    -bill 
  2. Stefan
    Admin
    Stefan avatar
    198 posts

    Posted 28 Jul 2014 Link to this post

    Hi Bill,

    It appears you're trying to profile your unit test run using the Visual Studio 2013 Performance Profiler. JustMock is not yet integrated with it. Try running the tests regularly without starting a profiling session.

    If you need to profile your tests using VS2013, please inform me, so that I can give this story a priority boost.

    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.

     
  3. DevCraft R3 2016 release webinar banner
  4. Bill
    Bill avatar
    13 posts
    Member since:
    Apr 2014

    Posted 29 Jul 2014 in reply to Stefan Link to this post

    The reason for trying to profile the test, was to see why the unit test was taking 20+ minutes when I mocked HttpContext, see another thread in this forum.

    thanks for your help.

    -bill
  5. Answer
    Stefan
    Admin
    Stefan avatar
    198 posts

    Posted 31 Jul 2014 Link to this post

    Hi Bill,

    If you wish to profile the unit tests I recommend that you use JustTrace. Follow the steps described here to get started.

    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.

     
Back to Top