SetupStatic - MockException: Opps , there were some error intercepting target call

24 posts, 0 answers
  1. DavidO
    DavidO avatar
    9 posts
    Member since:
    Jun 2010

    Posted 30 Jun 2010 Link to this post

    I get this exception "Telerik.JustMock.MockException: Opps , there were some error intercepting target call" when attempting to setup a static mock:

    Mock.SetupStatic<MyTest>();
    Mock.Arrange(() => MyTest.Parse("2")).Returns(new MyTest());

    the class I'm mocking is very simple:

    public class MyTest
    {
        public static MyTest Parse(string value)
        {
            return new MyTest();
        }
    }

  2. Ricky
    Admin
    Ricky avatar
    467 posts

    Posted 01 Jul 2010 Link to this post

    Hello David,

    There were some issues for SetupStatic , which is fixed now. Also, you can write the test like

    [TestMethod, Description("Ticket")]
    public void ShouldMockCallReturningInstanceForTheClass()
    {
        Mock.Arrange(() => MyTest.Parse("2")).Returns(new MyTest());
        var ret =  MyTest.Parse("2");
        Assert.NotNull(ret);
    }

    Here , i havent used the SetupStatic call , but rather it will be mocked on deman during Mock.Arrange().  Also, please make sure your JM profier / addin is not disabled while mocking static features.

    Addtionally, if you need a new build urgently please let me know, and provide me an email. I'll send it back to you.


    Regards,
    Mehfuz

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft R3 2016 release webinar banner
  4. DavidO
    DavidO avatar
    9 posts
    Member since:
    Jun 2010

    Posted 01 Jul 2010 Link to this post

    Thanks for the reply. But it seems the error "Opps, there were some error intercepting target call" is not happening just in SetupStatic. I seem to have trouble with the simplest examples. I am trying to mock just a simple class that I wrote and it keeps giving me this error. Here is one from the documentation that also fails. It fails on the first Mock.Arrange statement:

    [TestMethod] 
    public void JustMock_Test() 
        // Arrange 
        var foo = Mock.Create<Foo>(); 
     
        Mock.Arrange(() => foo.Echo(1)).Returns(1).MustBeCalled(); 
        Mock.Arrange(() => foo.Echo(2)).Returns(2); 
     
        // Act 
        var actual1 = 0
        var actual2 = 0
        actual1 = foo.Echo(1); 
        actual2 = foo.Echo(2); 
     
        // Assert 
        Assert.AreEqual(1, actual1); 
        Assert.AreEqual(2, actual2); 
        Mock.Assert(foo); 
     
     
    public class Foo 
        internal int Echo(int p) 
        { 
            return 99; 
        } 
     

    The error is "Test method ScriptHelper.Test.ScriptHelper_Test.JustMock_Test threw exception: 
    Telerik.JustMock.MockException: Opps , there were some error intercepting target call."

    Telerik.JustMock.Expectations.Expectation.(Invocation invocation) in c:\B\Basilisk\Basilisk CI Build\Sources\CodeBase\Telerik.JustMock\Expectations\Expectation.cs: line 43
    Telerik.JustMock.Expectations.Expectation.Process[TResult](Invocation invocation) in c:\B\Basilisk\Basilisk CI Build\Sources\CodeBase\Telerik.JustMock\Expectations\Expectation.cs: line 24
    Telerik.JustMock.Mock..Ÿ.€( x) in c:\B\Basilisk\Basilisk CI Build\Sources\CodeBase\Telerik.JustMock\Mock.cs: line 67
    ..[TDelgate,TReturn](† instruction, Func2`2 function) in c:\B\Basilisk\Basilisk CI Build\Sources\CodeBase\Telerik.JustMock\MockContext.cs: line 199
    Telerik.JustMock.Mock.Arrange[TResult](Expression`1 expression) in c:\B\Basilisk\Basilisk CI Build\Sources\CodeBase\Telerik.JustMock\Mock.cs: line 62
    ScriptHelper.Test.ScriptHelper_Test.JustMock_Test() in C:\Users\david.peterson\Documents\Visual Studio 2010\Projects\ScriptHelper.Test\ScriptHelper_Test.cs: line 921

    Thanks
  5. Ricky
    Admin
    Ricky avatar
    467 posts

    Posted 01 Jul 2010 Link to this post

    Hello David,
    Accoring to your example, your expected call is internal. The build which is out there,  dont support internal calls. We are shipping nonpublic mocking with the upcoming build.

    I can send you a preview build if urgent, but for that you have to provide me with any drop address.

    Regards,
    Mehfuz.

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. DavidO
    DavidO avatar
    9 posts
    Member since:
    Jun 2010

    Posted 01 Jul 2010 Link to this post

    A preview build may be appropriate, but I still get that odd error even when I switch the method to public.
  7. Ricky
    Admin
    Ricky avatar
    467 posts

    Posted 02 Jul 2010 Link to this post

    Hello David,
    That is very odd, can you plese check that after installing justmock , the examples are working properly. You will find similar tests under Elevated \FinalFixture , StaticFixture.cs. Examples can be found at %PROGRAM_FILES%\Telerik\JustMock\Examples.

    Regards
    Mehfuz

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  8. Burton Weldy
    Burton Weldy avatar
    7 posts
    Member since:
    Jan 2010

    Posted 02 Jul 2010 Link to this post

    I was getting the same ' Opps , there were some error intercepting target call.' error on my build machine, though I could get it to work locally.   Using the suggest work-around by just using Mock.Arrange did not work for the build machine.

    Is there a possible known reason why it would work locally but not on the build machine?  They both have the same JM version installed.

    I'm using the 2010 build definitions to execute my build.  A trivial mocking of an interface property works fine, but attempting to do something static does not.
  9. DavidO
    DavidO avatar
    9 posts
    Member since:
    Jun 2010

    Posted 02 Jul 2010 Link to this post

    I ran the samples and a percentage of them fail. I can send you the Visual Studio test results file if you tell me where to send it. Of 239 tests, 182 pass, 57 fail. Here are just the failing ones:

    Failed  ShouldCreateMockForSealedInternal   Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.SealedFixture.ShouldCreateMockForSealedInternal threw exception: ...     
    Failed  ShouldAssertCall    Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.StaticFixture.ShouldAssertCall threw exception: ...  
    Failed  ShouldCancelSqlConnectionOpen   Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.Regression.SqlConectionTest.ShouldCancelSqlConnectionOpen threw exception: ...   
    Failed  ShouldAssertGenericArgumentAsReturn Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.FinalFixture.ShouldAssertGenericArgumentAsReturn threw exception: ...    
    Failed  ShouldAssertCustomValueForDateTime  Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.MsCorlibFixture.ShouldAssertCustomValueForDateTime threw exception: ...  
    Failed  ShouldAssertExtensionMethodWithArguments    Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.ExtentionMethodFixture.ShouldAssertExtensionMethodWithArguments threw exception: ...     
    Failed  ShouldAssertStaticCalls Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.StaticFixture.ShouldAssertStaticCalls threw exception: ...   
    Failed  ShouldAssertFinalCalls  Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.SealedFixture.ShouldAssertFinalCalls threw exception: ...    
    Failed  ShouldAssertStaticGetOnProperty Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.StaticFixture.ShouldAssertStaticGetOnProperty threw exception: ...   
    Failed  ShouldAssertInvokedPartialCalls Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.PartialMockFixture.ShouldAssertInvokedPartialCalls threw exception: ...  
    Failed  ShouldAssertPropertyGet Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.FinalFixture.ShouldAssertPropertyGet threw exception: ...    
    Failed  ShouldVerifyCallOnPropertySet   Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.StaticFixture.ShouldVerifyCallOnPropertySet threw exception: ...     
    Failed  ShouldAssertFakeItemsAssignedWithWhereClauseFromUserQuery   Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.LinqFixture.ShouldAssertFakeItemsAssignedWithWhereClauseFromUserQuery threw exception: ...   
    Failed  ShouldMockConstraintMethodWithReturnReturnsASealedClassMock Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.Regression.MiscFixture.ShouldMockConstraintMethodWithReturnReturnsASealedClassMock threw exception: ...  
    Failed  ShouldAssertMocks   Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.MsCorlibFixture.ShouldAssertMocks threw exception: ...   
    Failed  ShouldThrowProperExceptionForPartailsThatAreNotInvokedDuringAssertion   Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.PartialMockFixture.ShouldThrowProperExceptionForPartailsThatAreNotInvokedDuringAssertion threw exception: ...    
    Failed  ShouldAssertArrangeOnStatic Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.StaticFixture.ShouldAssertArrangeOnStatic threw exception: ...   
    Failed  ShouldAssertInterfaceExtentensionMethodCall Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.ExtentionMethodFixture.ShouldAssertInterfaceExtentensionMethodCall threw exception: ...  
    Failed  ShouldAssertCallWithAReturn Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.MsCorlibFixture.ShouldAssertCallWithAReturn threw exception: ...     
    Failed  ShouldAssertCustomEventCall Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.FinalFixture.ShouldAssertCustomEventCall threw exception: ...    
    Failed  ShouldAssertReturnValueWhereTypeInheritedFromClass  Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.FinalFixture.ShouldAssertReturnValueWhereTypeInheritedFromClass threw exception: ...     
    Failed  ShouldAssertCallOriginal    Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.FinalFixture.ShouldAssertCallOriginal threw exception: ...   
    Failed  ShouldMockMethodWithConstraintGeneric   Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.FinalFixture.ShouldMockMethodWithConstraintGeneric threw exception: ...  
    Failed  ShouldVerifyPropertySet Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.FinalFixture.ShouldVerifyPropertySet threw exception: ...    
    Failed  ShouldAssertActions Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.FinalFixture.ShouldAssertActions threw exception: ...    
    Failed  ShouldAssertExtentionMethodWithMultipleArguments    Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.ExtentionMethodFixture.ShouldAssertExtentionMethodWithMultipleArguments threw exception: ...     
    Failed  ShouldMockCurrentHtppContext    Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.Regression.HttpContextTest.ShouldMockCurrentHtppContext threw exception: ...     
    Failed  ShouldMockClassWithGenericArguments Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.FinalFixture.ShouldMockClassWithGenericArguments threw exception: ...    
    Failed  ShouldAssertArrangeOnGenericCalls   Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.FinalFixture.ShouldAssertArrangeOnGenericCalls threw exception: ...  
    Failed  ShouldMockClassHavingWithSubConstraints Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.Regression.MiscFixture.ShouldMockClassHavingWithSubConstraints threw exception: ...  
    Failed  ShouldAssertGenericCalls    Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.FinalFixture.ShouldAssertGenericCalls threw exception: ...   
    Failed  ShouldAssertPartilalMethodSetup Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.StaticFixture.ShouldAssertPartilalMethodSetup threw exception: ...   
    Failed  ShouldAssertFinalMethodSetups   Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.FinalFixture.ShouldAssertFinalMethodSetups threw exception: ...  
    Failed  ShouldAssertRefArg  Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.FinalFixture.ShouldAssertRefArg threw exception: ...     
    Failed  ShouldAssertOriginalReturnForCallOriginal   Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.FinalFixture.ShouldAssertOriginalReturnForCallOriginal threw exception: ...  
    Failed  ShouldThrowForInvalidAssertion  Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.StaticFixture.ShouldThrowForInvalidAssertion threw exception: ...    
    Failed  ShouldMockInstanceCallPartially Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.PartialMockFixture.ShouldMockInstanceCallPartially threw exception: ...  
    Failed  ShoulAssertSetupOnMethodWithNestedGenConstraints    Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.Regression.MiscFixture.ShoulAssertSetupOnMethodWithNestedGenConstraints threw exception: ...     
    Failed  ShouldAssertSetupCalls  Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.MsCorlibFixture.ShouldAssertSetupCalls threw exception: ...  
    Failed  ShoudldMockMethodWithParameterTypeDefinedFromClassGenType   Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.Regression.MiscFixture.ShoudldMockMethodWithParameterTypeDefinedFromClassGenType threw exception: ...    
    Failed  ShouldAssertGenericArgumentWithClassForAction   Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.FinalFixture.ShouldAssertGenericArgumentWithClassForAction threw exception: ...  
    Failed  ShouldMockHttpContext   Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.Regression.HttpContextTest.ShouldMockHttpContext threw exception: ...    
    Failed  ShouldAssertGenericOutArguments Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.FinalFixture.ShouldAssertGenericOutArguments threw exception: ...    
    Failed  ShouldThrowExceptionForNotInovkedSetForMustBeCalled Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.Regression.MiscFixture.ShouldThrowExceptionForNotInovkedSetForMustBeCalled threw exception: ...  
    Failed  ShouldMockStaticFileOperation   Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.MsCorlibFixture.ShouldMockStaticFileOperation threw exception: ...   
    Failed  ShouldMockExtentionMethod_ThirdParty    Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.ExtentionMethodFixture.ShouldMockExtentionMethod_ThirdParty threw exception: ...     
    Failed  ShouldAssertGenericOutWithDefault   Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.FinalFixture.ShouldAssertGenericOutWithDefault threw exception: ...  
    Failed  ShouldAssertOutArg  Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.FinalFixture.ShouldAssertOutArg threw exception: ...     
    Failed  ShouldBeAbleToMockStaticClass   Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.StaticFixture.ShouldBeAbleToMockStaticClass threw exception: ...     
    Failed  ShouldTreatSetupsForTwoDifferentInstancesDifferently    Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.FinalFixture.ShouldTreatSetupsForTwoDifferentInstancesDifferently threw exception: ...   
    Failed  ShouldAssertExtensions  Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.ExtentionMethodFixture.ShouldAssertExtensions threw exception: ...   
    Failed  ShouldAssertStrictMockingOnStatic   Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.StaticFixture.ShouldAssertStrictMockingOnStatic threw exception: ...     
    Failed  ShouldAssertGenericValueTypeArg Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.FinalFixture.ShouldAssertGenericValueTypeArg threw exception: ...    
    Failed  ShouldAssertOverloads   Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.FinalFixture.ShouldAssertOverloads threw exception: ...  
    Failed  ShouldMockStaticFileForReadOperaton Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.MsCorlibFixture.ShouldMockStaticFileForReadOperaton threw exception: ...     
    Failed  ShouldAssertArrange Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.FinalFixture.ShouldAssertArrange threw exception: ...    
    Failed  ShouldArrangeStaticCallsDirectly    Telerik.JustMock.Tests.VS2010   Test method Telerik.JustMock.Tests.Elevated.PartialMockFixture.ShouldArrangeStaticCallsDirectly threw exception: ...     
     

  10. Ricky
    Admin
    Ricky avatar
    467 posts

    Posted 02 Jul 2010 Link to this post

    Hello David,

    It means all your proifler related tests are failing. Therefore, here is the troubleshooting:

    1. Do you have any profiler related tools installed in your visual studio Ex. Typemock, Dottrace or some other that is setting the COR_PROFILER variable before JM. This can interfere with JM profiler and make your tests fail.
    2.  Are you using a localized version of Visual studio ?  We fixed it  , but not released yet.

    3. If 1 and 2 is NO , then try re-installing the JM

    Since, profiler is not working, any tests with static or final methods will fail. But other tests with interface , virtual ,etc will still pass because they dont use profiler, they use proxy instead.


    Hope that helps,
    Mehfuz.

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  11. DavidO
    DavidO avatar
    9 posts
    Member since:
    Jun 2010

    Posted 02 Jul 2010 Link to this post

    I had both Typemock and Dottrace installed. I uninstalled both and now all the tests pass. Thank you! Is there a way to allow Dottrace to coexist with JustMock? It was just an eval version anyway. Thanks.
  12. Burton Weldy
    Burton Weldy avatar
    7 posts
    Member since:
    Jan 2010

    Posted 02 Jul 2010 Link to this post

    Re-installing did not help my issue with my TFS build machine not working.  Any other possibilities to the issue i posted earlier?
  13. Ricky
    Admin
    Ricky avatar
    467 posts

    Posted 05 Jul 2010 Link to this post

    Hi Guys ,

    @David , nice that things are working for you, We are woking on the dottrace integration , hopefully it will be out there sometime.


    @Burton : Please make sure that in the build machine you dont have any other profiler related tools or TypeMock installed. Also, if you are running the tests in automated build, you need to use the MSBuild task that came with the JM distribution. Also, is your all profiler related tests are failing ? If NO, try sending me an email at mehfuz.hossain att telerik.com i can provide you with a build.


    Hope that helps,
    Mehfuz

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  14. Burton Weldy
    Burton Weldy avatar
    7 posts
    Member since:
    Jan 2010

    Posted 06 Jul 2010 Link to this post

    The help for the automated build integration talks about using an MSBuild project.  In VS 2010, we are using the built in build process templates that are .xaml files.   Not MSBuild projects.

    I could use some instructions on how JustMock integrates into the 2010 build workflow.  I tried to use the JustMock.MSBuild.dll to add items to the toolbox, but that did not work.  
  15. Chris
    Admin
    Chris avatar
    221 posts

    Posted 06 Jul 2010 Link to this post

    Hi Burton,
    Could you provide more information on how you're running the automated builds on your build server?
    You mentioned "TFS build machine" in one of your previous posts and that suggests to me you're using Team Build to run your automated tests. Could you please verify whether this is correct?
    If you're using Team Build this means you're actually using MSBuild. In the Source Control Explorer you could take a look under your project's root folder (e.g. $/MyProject). There you should find the following folder: TeamBuildTypes/[The name of your build].
    There you should find a file named TFSBuild.proj.
    This is the MSBuild responsible for your build and you could apply the approach mentioned here:
    http://www.telerik.com/help/justmock/integration-msbuild-tasks.html

    Hope this information helps.

    Kind regards,
    Chris
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  16. Burton Weldy
    Burton Weldy avatar
    7 posts
    Member since:
    Jan 2010

    Posted 06 Jul 2010 Link to this post

    We are using Team Foundation Server to do all our building.  Previously we did not use MSBuild, so this is new to us.  In 2010 using TeamBuild, there is no Build projects, just XAML files that define the workflow.

    Under my project folder, there is a Build Process Template folder with .xaml files, but no projects because TeamBuild no longer uses them.   

    Here is quote from the beginning of the MSDN blog link below:

    "You see, build definitions in TFS 2008 are entirely automated using MSBuild. Whereas build definitions in TFS 2010 only use MSBuild for source code compilation and use Windows Workflow to orchestrate everything else that happens during the build process (setting up the workspace, running tests, indexing sources, copying binaries to the drop folder, associating changesets and work items, etc.). We refer to this workflow (it’s actually a XAML file) as a build process template."

  17. Chris
    Admin
    Chris avatar
    221 posts

    Posted 07 Jul 2010 Link to this post

    Hello Burton,
    I see. Yes, the situation with Team Build 2010 is a little bit different. Sorry for misleading you with my previous post.
    We haven't provided yet a workflow activity which you could easily drag and drop into you process template but we'll do that soon. For now you could use the following work around to make your tests aware of JustMock's profiler:

    1) First select your build in Team Explorer, right click it and select "Edit Build Definition".
    Then go to the "Process" category and click the "Show details" expander.
    Then click on the template (the xaml file) to open it. You could also first go to the respective folder in source control and branch it.


    2) Then in the workflow designer go to the "Run Tests" sequence.


    3) From VS Toolbox drag three times the InvokeMethod primitive activity right in the beginning of the Run Tests sequence.


    4) Set the following properties for each InvokeMethod activity:
    TargetType: System.Environment
    MethodName: SetEnvironmentVariable

    and then add two string parameters for each InvokeMethod.

    5) For the first InvokeMethod's parameters set the following values:

    "COR_ENABLE_PROFILING", "0x1"

    for the second method set:

    "COR_PROFILER", "{D1087F67-BEE8-4f53-B27A-4E01F64F3DA8}"

    and for the third method set:

    "COMPLUS_ProfAPI_ProfilerCompatibilitySetting", "EnableV2Profiler"

    6) Finally your Run Tests sequence should look like this:



    7) Check-in the .xaml file and run the build.

    I tested this locally and it worked fine. I hope this will work fine for you too.
    Should you have some other questions or problems, please don't hesitate to contact us.

    Kind regards,
    Chris
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  18. Burton Weldy
    Burton Weldy avatar
    7 posts
    Member since:
    Jan 2010

    Posted 07 Jul 2010 Link to this post

    Adding those steps to the workflow works great!   Thanks for finding a solution for me.

    Can't wait for the next build.  Each one is better than the previous.
  19. Jonathan Rajotte
    Jonathan Rajotte avatar
    82 posts
    Member since:
    Oct 2005

    Posted 15 Sep 2011 Link to this post

    Is the HowTo described two post above still the standard way of using JustMock with TFS2010?
  20. Ricky
    Admin
    Ricky avatar
    467 posts

    Posted 19 Sep 2011 Link to this post

    Hi Jonathan,

    Thanks for bringing up the question.

    Unfortunately, the above is still the way of configuring test environment for JustMock in Team Build 2010 but we are working on it and soon we will provide a CodeActivity workflow for JustMock that will consolidate the steps.

    Kind Regards,
    Mehfuz
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  21. Chris Rathermel
    Chris Rathermel avatar
    28 posts
    Member since:
    Dec 2006

    Posted 13 Sep 2012 Link to this post

    Ricky,

    This still the standard way of configuring test environment for JustMock in Team Build 2010 ?
  22. Ricky
    Admin
    Ricky avatar
    467 posts

    Posted 17 Sep 2012 Link to this post

    Hi David,

    Thanks again for bringing up the question. 

    Now, you can configure JustMock using the code activity workflow component that you can find under %Program_Files%\Teleirk\JustMock\Libraries folder in most recent releases. I would also request you to take a look into the following post for more detail on how to set it up:

    http://www.telerik.com/help/justmock/integration-code-activity-workflow.html 



    Kind Regards
    Ricky
    the Telerik team

    Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

  23. Chris Rathermel
    Chris Rathermel avatar
    28 posts
    Member since:
    Dec 2006

    Posted 17 Sep 2012 Link to this post

    Hey Ricky,

    I tried to follow that article on modifying the DefaultBuildTemplate.xaml by adding the JustMockTestRunner in replace of the 3 MSTest calls that are referenced in the article.  

    My issue is that even though I configure my build controller properties to point to the new JustMock assemblies and get the just mock test runner in my toolbox.  When I try and drag and drop the new JustMockTestRunner from the tool box into the design surface of the DefaultBuildTemplate.xaml a "X" is shown that it isn't possible and when I "drop" it doesn't add the item to the design surface. 

    I created a support ticket but if you have any ideas feel free to reply.. 

    Thanks,

    Chris
  24. Jonathan Rajotte
    Jonathan Rajotte avatar
    82 posts
    Member since:
    Oct 2005

    Posted 17 Sep 2012 Link to this post

    Hey Chris,

    make sure to follow these steps from the doc:

    BTW, the solution mentioned here could be any solution, you can create a new one if you want.

    Continue by adding a new class library project to your Solution. To modify the build template you need to include it in the project you created, using the "Add as Link" option and after that set its build action to none. If you are new to TFS, the DefaultTemplate is a xaml file where the activity is dropped. You can find it under the BuildProcessTemplates folder of your TFS: 

    In order to drag/drop the JustMockTestRunner activity to your build template, you have to add a reference to the Telerik.JustMock.Build.Workflow.dll assembly 
  25. Ricky
    Admin
    Ricky avatar
    467 posts

    Posted 20 Sep 2012 Link to this post

    Hi David,
    Thanks again for contacting us. Also thanks to Jonathan for jumping in. In order to drag / drop the activity to build template please further confirm the following steps:

    1. Create a class library project
    2. Add a reference to Telerik.JustMock.Build.Workflow.DLL to the project.
    3. Add a link to the build template file and don't forget to set the build action to none (not required).

    In addition, make sure that you have removed the existing Run MSTest activities. 

    Let me know if you still facing issues. 

    Kind Regards
    Ricky
    the Telerik team

    Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

Back to Top
DevCraft R3 2016 release webinar banner