This is a migrated thread and some comments may be shown as answers.

JustMockRunner and CruiseControl.Net

3 Answers 25 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Hesham Desouky
Top achievements
Rank 2
Hesham Desouky asked on 20 Nov 2012, 03:46 PM
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!

3 Answers, 1 is accepted

Sort by
0
Ricky
Telerik team
answered on 20 Nov 2012, 05:00 PM
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.

0
Hesham Desouky
Top achievements
Rank 2
answered on 21 Nov 2012, 09:00 AM
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.
0
Kaloyan
Telerik team
answered on 26 Nov 2012, 12:21 PM
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.
Tags
General Discussions
Asked by
Hesham Desouky
Top achievements
Rank 2
Answers by
Ricky
Telerik team
Hesham Desouky
Top achievements
Rank 2
Kaloyan
Telerik team
Share this question
or