Welcome to Typemock Answers. Here you can ask and receive answers from other community members. And if you liked or disliked an answer or thread: react with an up- or downvote Enjoy!

Tests fail on TFS Build Server

+3 votes
I have installed Isolator 7.0 on our build server and updated our build to use the TypemockStart and TypemockStop build activities (we previously used another build activity which uses tmockrunner.exe).

The project I am using has the following (version 6.02) assemblies in it's source control (added via a nuget package):

*Typemock.ArrangeActAssert
*TypeMock.CLI.Common
*TypeMock
*TypeMock.Integration
*Typemock.Interceptors
*TypeMock.MSBuild

When the tests run on the build server they fail with:

Unit Test Adapter threw exception: 
Could not load file or assembly 'Typemock.ArrangeActAssert, Version=6.0.2.0, Culture=neutral, PublicKeyToken=3dae460033b8d8e2' or one of its dependencies. The system cannot find the file specified..


All the tests run fine locally using Isolator 7.0 (or 6.0.2).
asked Apr 26, 2012 by Squid (1,300 points)

20 Answers

+3 votes
Also fails when executing:

tmockrunner.exe mstest.exe /testcontainer:someAssembly.dll


On local machine and build server. Works when executing test through VS2010 interface locally.
answered Apr 26, 2012 by Squid (1,300 points)
+2 votes
Hi,

Can you please add Configuration.dll also and check if it reproduces?

Regards,
Elisha
Typemock Support
answered Apr 26, 2012 by Elisha (22,740 points)
+3 votes
Elisha - Negative.

Just to be sure I copied the entire typemock directory to my bin directory and tried to run tmockrunner.exe.

I get the following warning when doing so (after all tests fail with the above "could not find typemock.arragneactassert version 6.0.2 etc" error):
Run has the following issue(s):
Warning: Test Run deployment issue: Failed to deploy dependencies for test stora
ge 'D:\tfs\P01784 SBR ACT SRO\Dev\SBRACT\ServiceImplementationTests\bin\Debug\se
rviceimplementationtests.dll': System.InvalidOperationException: Code execution
is prohibited in an assembly loaded as ReflectionOnly.
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments,
 Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invoke
Attr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisib
ilityChecks)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invoke
Attr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at Typemock.Interceptors.Profiler.InternalMockManager.ReflectionCallbacks.OnI
sMockedReflectionCallback(Object context, String typeName, String methodName, Ob
ject methodGenericParameters, Boolean isInjected, Boolean isIntercepted)
   at Typemock.Interceptors.Profiler.InternalMockManager.isMocked(Object that, S
tring typeName, String methodName, Object methodParameters, Boolean isInjected,
Boolean isIntercepted)
   at System.Text.RegularExpressions.Regex.Match(String input)
   at Microsoft.VisualStudio.TestTools.Utility.AssemblyLoadWorker.NeedToBeFilter
edOut(String assemblyName)
   at Microsoft.VisualStudio.TestTools.Utility.AssemblyLoadWorker.GetDependentAs
sembliesInternal(String assemblyString)
   at Microsoft.VisualStudio.TestTools.Utility.AssemblyLoadWorker.ProcessChildre
n(Assembly assembly)
   at Microsoft.VisualStudio.TestTools.Utility.AssemblyLoadWorker.GetDependentAs
sembliesInternal(String assemblyString)
   at Microsoft.VisualStudio.TestTools.Utility.AssemblyLoadWorker.ProcessChildre
n(Assembly assembly)
   at Microsoft.VisualStudio.TestTools.Utility.AssemblyLoadWorker.GetDependentAs
semblies(String path)
   at Microsoft.VisualStudio.TestTools.Utility.AssemblyLoadWorker.GetDependentAs
semblies(String path)
   at Microsoft.VisualStudio.TestTools.Utility.AssemblyLoadStrategy.GetDependent
Assemblies(String path)
   at Microsoft.VisualStudio.TestTools.Utility.AssemblyHelper.GetDependentAssemb
lies(String path, DependentAssemblyOptions options, String configFile)
   at Microsoft.VisualStudio.TestTools.TestManagement.DeploymentManager.GetDepen
dencies(String master, String configFile, TestRunConfiguration runConfig, Deploy
mentItemOrigin dependencyOrigin, List`1 dependencyDeploymentItems, Dictionary`2
missingDependentAssemblies)
   at Microsoft.VisualStudio.TestTools.TestManagement.DeploymentManager.ProcessN
ewStorage(String testStorage, DeploymentHelper helper, DeploymentItemOriginType
originType, List`1 deploymentCoverageItems, TestRunConfiguration runConfig, List
`1 dependencyDeploymentItems, Dictionary`2 missingDependentAssemblies)


I don't get this waring when running the same tmockrunner command with 6.0.2 installed. I am not sure if it is related.
answered Apr 27, 2012 by Squid (1,300 points)
0 votes
We are getting an identical behavior on a test suite running 6.0.2 locally and 7.0.5 on the build server. Test runs locally and through IDE on the build server. However when running from cmd with tmockrunner or through a team build def. on the build server, it fails with an unrelated error to WCF close on a proxy object.

Output running with and without tmockrunner (7.0.5) for a single test:
C:\Builds\53\someproject\Build_Dev_Stage\TestResults\TFS2010BUILD_TFS2010BUILD1 2012-04-30 11_52_02\Out>mstest  /runconfig:LocalTestRun.testrunconfig  /detail:errormessage /testcontainer:hoofrecording.integrationtests.dll /test:Her
dEntityServiceTest
Microsoft (R) Test Execution Command Line Tool Version 9.0.30729.1
Copyright (c) Microsoft Corporation. All rights reserved.

Loading LocalTestRun.testrunconfig...
Loading hoofrecording.integrationtests.dll...
Starting execution...

Results               Top Level Tests
-------               ---------------
Passed                DLBR.DCF.HoofRecording.IntegrationTests.DCFServiceConfigurationTest.HerdEntityServiceTest
1/1 test(s) Passed

Summary
-------
Test Run Completed.
  Passed  1
  ---------
  Total   1

C:\Builds\53\someproject\Build_Dev_Stage\TestResults\TFS2010BUILD_TFS2010BUILD1 2012-04-30 11_52_02\Out>tmockrunner mstest  /runconfig:LocalTestRun.testrunconfig  /detail:errormessage /testcontainer:hoofrecording.integrationtests.d
ll /test:HerdEntityServiceTest
/runconfig:LocalTestRun.testrunconfig /detail:errormessage /testcontainer:hoofrecording.integrationtests.dll /test:HerdEntityServiceTest
Microsoft (R) Test Execution Command Line Tool Version 9.0.30729.1
Copyright (c) Microsoft Corporation. All rights reserved.

Loading LocalTestRun.testrunconfig...
Loading hoofrecording.integrationtests.dll...
Starting execution...

Results               Top Level Tests
-------               ---------------
Failed                DLBR.DCF.HoofRecording.IntegrationTests.DCFServiceConfigurationTest.HerdEntityServiceTest
[errormessage] = Test method DLBR.DCF.HoofRecording.IntegrationTests.DCFServiceConfigurationTest.HerdEntityServiceTest threw exception:  System.ServiceModel.CommunicationObjectFaultedException: The communication object, System.ServiceModel.
ChannelFactory`1[DLBR.DCF.HoofRecording.DataAccess.HerdEntityService.HerdEntityServiceContract], cannot be used for communication because it is in the Faulted state..
0/1 test(s) Passed, 1 Failed

Summary
-------
Test Run Failed.
  Failed  1
  ---------
  Total   1


Note that when running with tmockrunner 6.0.2 it doesn't fail. Running with tmockrunner 7.0.5 it fails.
answered Apr 30, 2012 by jnus (1,060 points)
+2 votes
Hi,

This doesn't seem to relate to automated build but to the version change. I'd like to fix this issue, can you please send us a small repro project if it's possible?

Regards,
Elisha,
Typemock Support
answered Apr 30, 2012 by Elisha (22,740 points)
0 votes
Hi

I can't really isolate the problem in a single test project and send it to you. It's an integration tests, with too many dependencies. How does tmockrunner differ from mstest? I'm a little puzzled that a test that's not using typemock (test however do use typemock in this assembly and works) should fail when running with tmockrunner and succeed with mstest...
answered May 3, 2012 by jnus (1,060 points)
0 votes
Hi,
TmockRunner is just a tool to enable the Isolator profiler on the running process.
Sometimes there are minor differences between gui runners and command line runners that may lead to these kind of problems.
Can you please run the failed test with logging enabled and send us the results?
To enable log in TMockRunner use the logpath argument:
TMockRunner.exe -logpath <PathToLogFolder> mstest


Please send the logs to: support at typemock.com
answered May 4, 2012 by ohad (37,080 points)
0 votes
e-mail sent.
answered May 7, 2012 by jnus (1,060 points)
+3 votes
Attached is a sample project.

Works locally with Isolator 6 or 7, fails on the build server (Isolator Server 7.0.6).

Works when you disable code coverage in local.testsettings

When you enable code coverage you get the warning noted above and all tests fail.
answered May 8, 2012 by Squid (1,300 points)
+2 votes
Hi,

I can't see the attached file. Can you please post again or email it to our support?
answered May 8, 2012 by Elisha (22,740 points)
...