Visual Studio Team Test Load Agent Goes 64 Bit!

The Visual Studio Team System test platform provides host processes for running tests. In Visual Studio 2008, the host process is only capable of running tests in 32 bit mode. As a 32 bit process, it was limited to running test assemblies on the 32 bit CLR and was limited to 2GB of memory.  Now in Visual Studio 2010, we added support for executing tests on the 32 or 64 bit CLR from Visual Studio or on a remote Load Agent.  This will allow you to use >2GB of memory (when executing on the 64 bit CLR) in your tests and most importantly test your assemblies on the 64 bit CLR.

Great, so how can I get my tests to execute on the 64 bit CLR?

To get your test assemblies to execute on the 64 bit CLR, you need to do three things:

1. Target your test assembly for the “Any CPU” platform.

  • Open the properties of your test assembly, select the “Build” tab and then choose the “Any CPU” option for the Platform target:

image

2. Set the Host Process Platform flag to “MSIL”.

  • Open the Test Settings and select the “Host” Page.
  • Choose MSIL for the Host Process Platform.

image

3. Run the tests on an operating system that supports the 64 bit CLR.

What do I need to know before I try out 64 bit test execution?

Before you try to execute your tests on the 64 bit CLR, there are a few concepts that I need to explain. First, there are four different ways that you can compile your test assembly (“Any CPU”, “x64”, “x86”, and “Itanium”).  Out of these four ways that you can compile your assembly, we really only support two (“Any CPU” and “x86”).  Next, in order to support forcing a test to execute on the 32 bit CLR when the 64 bit CLR is available, we introduced a concept of a Host Process Platform flag.  This flag has two settings (“MSIL” and “x86”) and allows you to specify how you would like your tests to be executed.

MSIL

This means that if the host process (Visual Studio or Load Agent) is running on a 64 bit operating system and the 64 bit CLR is available and nothing else is preventing the assembly from running in 64 bit mode, the test assembly will execute on the 64 bit CLR. If any of these things are not in place, then the assembly will execute on the 32 bit CLR.

Note: This does not guarantee that it will execute on the 64 bit CLR.

x86

This means that the test assembly will always execute on the 32 bit CLR regardless of whether or not the 64 bit CLR is available.

Note: This is the default setting.

In Visual Studio 2008, tests were executed in the VSTestHost.exe process or the QTAgent.exe process.  In Visual Studio 2010, this has changed.  All test assemblies are now executed in either the QTAgent32.exe or the QTAgent.exe process.  Which process is determined by a combination of the Host Process Platform flag and the “bitness” of the Machine OS.  The following table describes which process will be launched and on which version of the CLR that the test assembly will be executed.

32 Bit

x86

QTAgent32.exe

32 Bit

MSIL

64 Bit

x86

QTAgent32.exe

32 Bit

MSIL

QTAgent.exe   

64 Bit if available, otherwise 32 Bit.

There is a Gotcha!

As I stated earlier, we really only support test assemblies that target the “Any CPU” or “x86” platforms.  Under certain conditions, you may be able to run test assemblies that specifically target the “x64” platform.  However, for certain test types (unit tests in particular), MSTest.exe will need to load the test assembly into its own process.  Since MSTest.exe is a 32 bit process, the test assembly needs to be able to load into a 32 bit process (in other words it must target the x86 or “Any CPU” architecture) to load properly.  This means that if you specifically target the x64 platform and you are using one of these test types, regardless of the setting of the Host Process Platform flag, the test assembly will fail to load and the tests will be aborted.  Additionally, because the JET database is and remains a 32 bit application,  CSV (as well as any data sources that require the JET database) are not supported when executing test assemblies on the 64 bit CLR. 

Try it out and let me know

If you haven’t done so already, please download the Beta1 build of Visual Studio Team System 2010.  Then try out the 64 bit test execution and let me know what you think.  We would love to hear your feedback.

Where is the 64 bit Load Agent Installer?

Although there is not a 64 bit installation for the Load Agent, fear not as the binaries that enable 64 bit test execution are installed with the standard 32 bit installer for the Team Test Load Agent.