JustMockRunner and CruiseControl.Net

4 posts, 0 answers
  1. Hesham Desouky
    Hesham Desouky avatar
    27 posts
    Member since:
    Oct 2012

    Posted 20 Nov 2012 Link to this post

    I am facing a strange problem when executing unit testes using JustMockRunner from Exec task under CruiseControl.Net

    The same command line make the test pass, but from inside the CruiseControl.Net the test failed.

    I am using Future Mocking for this unit test.

    I reviewed the event viewer and found no errors regarding Profile Loading, the test fails because it didn't use my Future mocking and calls the direct methods.

    Below is the code I am using for future Mocking
    [TestMethod]
    public void Load_Default_Profile_For_New_User()
    {
        var userProfileService = Mock.Create<UserProfileServiceBase>(Behavior.Loose);
     
        Mock.Arrange(() => userProfileService.GetByUserId(Arg.AnyInt)).IgnoreInstance().Returns<int>(id => { return null; });
        Mock.Arrange(() => userProfileService.Insert(Arg.IsAny<UserProfile>())).IgnoreInstance().Returns(true);
     
        Assert.IsTrue(Mock.IsProfilerEnabled, "Profiler not enabled");
        var userService = new PaXtreme.Services.UserService();
     
        var userProfile = userService.GetUserProfile(1);
        Assert.IsNotNull(userProfile);
        Assert.IsFalse(string.IsNullOrEmpty(userProfile.ProfileData));
    }

    This test uses Future mocking when running under VS 2012 and from command prompt

    What I am missing!
  2. Ricky
    Admin
    Ricky avatar
    467 posts

    Posted 20 Nov 2012 Link to this post

    Hi Hesham,

    Thanks again for contacting us. 
    However, if you run JustMockRunner.Exe under CruiseControl.Net does the following line pass?

    Assert.IsTrue(Mock.IsProfilerEnabled);

    If so then I would request you to send us a copy of your test project which we will run in our dev machine to reproduce the problem.

    Kind Regards
    Ricky
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft R3 2016 release webinar banner
  4. Hesham Desouky
    Hesham Desouky avatar
    27 posts
    Member since:
    Oct 2012

    Posted 21 Nov 2012 Link to this post

    The  Assert.IsTrue(Mock.IsProfilerEnabled, "Profiler not enabled") assert 

    I don't understand how calling the JustMockrunner from command line (using the same user account as the same user account running the CruiseControl.Net) is working and as Executable task from CruiseControl.Net fails.
  5. Kaloyan
    Admin
    Kaloyan avatar
    872 posts

    Posted 26 Nov 2012 Link to this post

    Hello Hesham,

     We apologize for the late reply.

     However, we tried to reproduce the environment you are facing, and successfully builded a test project using CruiseControl.NET and the JustMockRunner. All of our tests (elevated and non-elevated) passed as expected in it.

     To investigate further the issue, we will need a screenshot, from the event viewer from an event with ID = 1022, captured just after you have run the build engine and the tests have failed. We have doubts that the JustMock profiler is not responding to the build.

     Thank you for the cooperation in advance.

    Greetings,
    Kaloyan
    the Telerik team
    Share what you think about JustTrace & JustMock with us, so we can become even better! You can use the built-in feedback tool inside JustTrace, our forums, or our JustTrace or JustMock portals.
Back to Top