Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

How do I use with typemock?
pete
#1 Posted : Monday, February 6, 2012 4:11:34 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 2/6/2012(UTC)
Posts: 2
Location: Greenville, SC

I saw in the release notes that it works with TypeMock, but I'm not sure how to set it up. All my TypeMock tests are failing.
Remco
#2 Posted : Monday, February 6, 2012 9:14:27 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,123

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
Hi Pete,

Thanks for posting! NCrunch should auto-detect TypeMock and host it in the task environment. Are you able to provide any more information about how the tests are failing? If you're able to submit a bug report after your tests fail, this would be very useful in identifying why it's not working.


Cheers,

Remco
pete
#3 Posted : Tuesday, February 7, 2012 1:58:26 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 2/6/2012(UTC)
Posts: 2
Location: Greenville, SC

Here's an example failure:

TypeMock.VerifyException :
TypeMock Verification: Call to nCrunch.TestRuntime.TestCoverageEventListener.MarkTestLineStart() Parameter: 1
expected: <(null)>
but was: <2>
at dq.a(Object A_0, String A_1, String A_2, MethodBase A_3, Object[] A_4, Object A_5)
at TypeMock.MockManager.a(String A_0, String A_1, Object A_2, Object A_3, Boolean A_4, Boolean A_5, Object[] A_6)
at TypeMock.InternalMockManager.getReturn(Object that, String typeName, String methodName, Object methodParameters, Boolean isInjected, Boolean isInterceptedType, Object p1, Object p2, Object p3, Object p4)
at nCrunch.TestRuntime.TestCoverageEventListener.MarkTestLineStart(Int32 componentId, Int32 coverageMarkerIndex, Int32& existingCoverageMarkerIndex, UInt32& existingTickCount)
at TetraData.Common.SQL.DbCommandExecute.ExecuteScriptSplitOnGo(ITDDbConnection conn, String sql) in c:\dev7\source\Shared\Common\DbCommandExecute.cs:line 0
at CommonTests.DbCommandExecuteFixture.ExecuteScriptSplitOnGo() in c:\dev7\source\Shared\Common\CommonTests\DbCommandExecuteFixture.cs:line 37

One thing worth mentioning, this test uses the old style Typemock with RecordExpectataions, not the new Isolate. Does that make a difference to you, or is that all contained within the TypeMock engine?

Thanks,

pete
Remco
#4 Posted : Tuesday, February 7, 2012 9:29:21 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,123

Thanks: 957 times
Was thanked: 1286 time(s) in 1193 post(s)
Yes - NCrunch does have issues with the RecordExpectations syntax. The instrumentation placed by NCrunch is causing TypeMock to make incorrect assessments about your test expectations.

There are two ways you can work around this:

1. Avoid using RecordExpectations - This is the best option but I understand that it may cause a bit of pain

2. Set the 'Instrument assembly' option to 'False' for your test assemblies that are making use of RecordExpectations. You'll lose NCrunch code coverage on these assemblies, but the tests should run OK. The more important test coverage would be on your code under test anyway, so this may work for you. You could take this approach a little further by moving the tests with RecordExpectations into their own assembly so that you can still have code coverage over your other tests.


Cheers,

Remco
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.030 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download