chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes
I have a couple of tests in which I mock the current date/time (see below). The test run fine when running in Visual Studio. However, when I run these tests in Team City, they both fail with the following message. It is not an installation/version issue because the test run fine in VS2010 on that machine, as well - it is only when run from team city that the test fail.

Any help??

Test:

<TestMethod(), Isolated()> _
    Public Sub IsValidOrderStartDateTest()

        Using TheseCalls.WillReturn(#12/1/2011#)
            Dim b = DateTime.Now
        End Using

        ...
    End Sub


Error:

Test method CTM.VPOffice_Unit_Testing.DigitalNetworkOrderTest.IsValidOrderStartDateTest threw exception:
TypeMock.TypeMockException:
*** No method calls found inside using block
at jc.d()
at jc.a()
at jc.b()
at CTM.VPOffice_Unit_Testing.DigitalNetworkOrderTest.IsValidOrderStartDateTest() in C:continuousintegration ootCTM_VPOFFICEClassLibrariesCTM_VPOFFICEClassLibrariesCTM.VPOfficeCTM.VPOffice Unit TestingDigitalNetworkOrderTest.vb:line 401
at Typemock.Isolator.VisualBasic.IsolatedAttribute.Execute()
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)
at CTM.VPOffice_Unit_Testing.DigitalNetworkOrderTest.IsValidOrderStartDateTest() in C:continuousintegration ootCTM_VPOFFICEClassLibrariesCTM_VPOFFICEClassLibrariesCTM.VPOfficeCTM.VPOffice Unit TestingDigitalNetworkOrderTest.vb:line 400
asked by Shane Boucvalt (680 points)

4 Answers

0 votes
Hi,

Sorry I tried to reproduce the problem but without success.
Is it possible to for you to install the latest version of the Isolator and see if you still get the same error?
answered by ohad (35.4k points)
0 votes
We cannot upgrade because we did not purchase support when we purchased the software (I tried). Or am I wrong that you can not upgrade if you do not have support? Are you trying to reproduce the problem in version v6.1.2?
answered by Shane Boucvalt (680 points)
0 votes
We have upgraded to the latest version ,and we still get the error (But ONLY when running through team city).

Below is the script we are using:

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="RunTests" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

    <UsingTask TaskName="NCover.MSBuildTasks.NCover" AssemblyFile="C:Program FilesNCoverBuild Task PluginsNCover.MSBuildTasks.dll" />
    <Import Project ="C:Program Files (x86)TypemockIsolatorTypeMock.MSBuild.Tasks" />

    <PropertyGroup>
         <MSTest>"C:Program Files (x86)Microsoft Visual Studio 10.0Common7IDEMSTest.exe"</MSTest>  
    <TMock>"C:Program Files (x86)TypemockIsolatorTMockRunner.exe"</TMock>  
    </PropertyGroup>


    <Target Name ="RunTests">
         <TypeMockStart Target="4.0" />
         <Exec ContinueOnError="true"  Command='$(MSTest) "/testcontainer:C:continuousintegration
ootCTM_VPOFFICEClassLibraries

CTM_VPOFFICEClassLibrariesCTM.VPOfficeCTM.VPOffice Unit TestinginReleaseCTM.VPOffice Unit Testing.dll"' />
         <TypeMockStop />
   <Message Text="##teamcity[importData type='mstest' path='c:continuousintegrationTestResults']" />
    </Target>
</Project>
answered by Shane Boucvalt (680 points)
0 votes
Hi,

Is there another build that runs on the same build agent which uses Auto-Deploy or linking with other profiler such as coverage profiler?

Just to make sure - tests which do not use DateTime fakes pass consistently?

In addition there are two option I'd like to test which could rule out a few options:

Remove Target property
Try to execute the tests without explicit framework - replace the following:
<TypeMockStart Target="4.0" />

With:
<TypeMockStart />


Execute with TMockRunner instead of build tasks
Remove the TypeMockStart and TypeMockStop tasks and instead execute the MStest under TMockRunner:
<Exec ContinueOnError="true"  Command='$(TMock) $(MSTest) "/testcontainer:C:continuousintegration
ootCTM_VPOFFICEClassLibrariesCTM_VPOFFICEClassLibrariesCTM.VPOfficeCTM.VPOffice Unit TestinginReleaseCTM.VPOffice Unit Testing.dll"' />


Please let me know if the results differ from the current ones.
answered by Elisha (12k points)
...