Article relates to
Last modified by
Even though JustMock goes nicely with the most automated
build servers (or Continuous Integration Servers), sometimes it can be tricky.
This article answers some of the most frequently asked
Q: Do I need to install
JustMock on the build machine?
A: When JustMock runs in
elevated mode it operates as a .NET profiler so it can overwrite IL code at
runtime. To configure profilers like this for .NET Framework v2.0/v3.0/v3.5, Microsoft
requires registration of the profiler as a COM component. The COR_PROFILER
environment variable is the GUID for the JustMock COM component(more information could be found here). For .NET
Framework v4.0/v4.5 you can take advantage of COR_PROFILER_PATH environment
variable(described here). We strongly recommend installing JustMock on the build server,
because the installation takes care for COM registration itself.
If installing JustMock on
the build machine can not be done, another option is to register the
Telerik.CodeWeaver.DLL manually for both 32 and 64bits modes. You can use
regsvr32.exe tool to accomplish this.
Q: Do I need to have Visual
Studio installed on the build machine?
A: Visual Studio is not required by JustMcok on the build machine. If you are using MSTest for a test framework
in your project, please refer to the Microsoft documentation for build server dependencies, but in short, MSTest requiers Visual Studio on your build server.
Q: My tests are failing with
"The type or namespace name 'Telerik'
could not be found (are you missing a using directive or an assembly
A: While, it is recommended to put the JustMock assemblies(JustMock.DLL and
CodeWeaver.Api.DLL) into the Global Assembly Cache(GAC), is not required. If you choose not to place the assemblies in the GAC, make sure
that you have the DLLs correctly referenced and in the correct folder.
Q: My tests are failing with
"Type 'Telerik.JustMock.MockException' in
assembly 'Telerik.JustMock, Version= 2012.3
1016, Culture=neutral, PublicKeyToken=8b221631f7271365' is not marked as serializable.”
A: The main problem here is
that the Telerik.CodeWeaver.Api.DLL assembly that is referenced by JustMock is not found with the project binaries, causing the MockException is thrown. To fix this, ensure that the Telerik.CodeWeaver.Api.DLL assembly is copied to the correct binaries folder. You can also use the “Workspace” tab to specify what other
files (not in your project) to be copied to the build directory.
“Any exception concerning
that the profiler is not enabled”
A: This exception will only be thrown if you are using the elevated features of JustMock in
your tests. There are several known reasons that can cause this exception:
Q: Sometimes there are
failing tests on the server side when everything has passed on the local
machine. What is the reason and what could be done about this?
A: If you are using the
elevated features of JustMock in your test project, the reason for tests to
fail could be the order of their execution. The JIT Compilation of a certain
class under test before its mocked instance will lead to throwing of an
exception inside the test method using this mocked object and accordingly to
the failure of the test.
We know that the execution
order should not affect the test results by any mean. For this, we recommend
the splitting of the tests in two different assemblies. One for the tests using
the profiler(elevated tests) and another one for the rest.
Q: Where can I find more
information about integrating JustMock with other 3rd party tools?
A: You can check our online help documentation
for articles, concerning JustMock integration with other 3rd
party software. Also, you could try searching for something more specific in our
forum where you could find a pinned article with the latest online resources. And finally don`t forget to look in our Just*Team blogposts.
Copyright © 2017, Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks or appropriate markings.