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

Issue with NUnit and PartCover

1 Answer 104 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Devin
Top achievements
Rank 1
Devin asked on 10 Aug 2011, 07:08 PM
I have a unit test that, when run via the Resharper test runner (which uses NUnit), passes.  However, if I run the same test via the nunit-console (as executed by PartCover), I get the following error:

Test Error : Core.Busi.Unit_Tests.MILSearchJustMockTests.TestGetRetiredItemByID_JustMock
   Telerik.JustMock.MockException : There were some problems intercepting the mock call. Optionally, please make sure that you have turned on JustMock's profiler while mocking concrete members.
   at Telerik.JustMock.Expectations.Expectation.?(Invocation invocation) in c:\B\Basilisk\Basilisk CI Build\Sources\CodeBase\Telerik.JustMock\Expectations\Expectation.cs:line 37
   at Telerik.JustMock.Expectations.Expectation.Process[TResult](Invocation invocation) in c:\B\Basilisk\Basilisk CI Build\Sources\CodeBase\Telerik.JustMock\Expectations\Expectation.cs:line 18
   at Telerik.JustMock.Mock..?.?(? x) in c:\B\Basilisk\Basilisk CI Build\Sources\CodeBase\Telerik.JustMock\Mock.cs:line 75
   at ?.?.?[?,?]( instruction, Func`2 function) in c:\B\Basilisk\Basilisk CI Build\Sources\CodeBase\Telerik.JustMock\MockContext.cs:line 238
   at Telerik.JustMock.Mock.Arrange[TResult](Expression`1 expression) in c:\B\Basilisk\Basilisk CI Build\Sources\CodeBase\Telerik.JustMock\Mock.cs:line 72
   at Core.Busi.Unit_Tests.MILSearchJustMockTests.SetupMocks() in C:\sd\Trunk\core\Asm\Busi\Busi\Unit Tests\MILSearch.JustMock.cs:line 51

I made sure the JustMock is enabled.  I even recompiled the PartCover.dll with the instructions mentioned here, but I still get the same issue.  Is there something I need to register to run the console version of nunit/PartCover? 

Please let me know if you need more information.  Thanks!


   at Core.Busi.Unit_Tests.MILSearchJustMockTests.TestGetRetiredItemByID_JustMock() in C:\sd\Trunk\core\Asm\Busi\Busi\Unit Tests\MILSearch.JustMock.cs:line 67

1 Answer, 1 is accepted

Sort by
0
Ricky
Telerik team
answered on 12 Aug 2011, 10:43 AM
Hi Devin,

Thanks again for the reply.

In order to run JustMock using nunit console. You fist need to set the profiling variable correctly and then run it as a child process.

In order to do so i would recommend you to take a look at this following post:
http://weblogs.asp.net/mehfuzh/archive/2011/05/24/running-justmock-profiler-outside-of-visual-studio.aspx

Here it mentions an exe called JustMockrunner that is piped with nunit-console.exe. In order to superset the whole thing with PartCover, the following should be done:

in your PartCover configuration you need to mention the target starting with JustMockRunner
JustMockRunner.exe "%Path to test runner%\nunit-console.exe”

Followed by the target test assembly that should look like:
"%PathToDir%\JustMockTrialTests.dll"

Here please note the Quote(""), that is required by JustMockRunner. For configuring PartCover with nunit console you might also like to take a look at this:
http://www.csharpcity.com/using-partcover-and-nunit-for-code-coverage/

Hope this information is useful.

Kind Regards,
Mehfuz
the Telerik team

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

Tags
General Discussions
Asked by
Devin
Top achievements
Rank 1
Answers by
Ricky
Telerik team
Share this question
or