Geeks With Blogs

News View Michael Stephenson's profile on BizTalk Blog Doc View Michael Stephenson's profile on LinkedIn
Michael Stephenson keeping your feet on premise while your heads in the cloud

This was a small issue i came across the other day, just thought would add a note about it like i usually do.

Problem

When running my tests in visual studio everything is fine and they all pass.  In this particular case they were actually BizUnit tests where some of my steps use a proxy class which i have created and is in a seperate assembly.  In my assembly where i have my tests i have just added a reference even though my code does not directly use the assembly i reference.

The problem is when i run my tests of the command line using mstest.  I get an error that the proxy type can not be found and it turns out that the assembly containing it hasnt been copied to the test run folder where as when running them in the IDE it is copied.

Solution

The way i solved this was to add a deployment item to the test run config.  This will ensure the proxy assembly is copied to the folder regardless if the tests are ran from the command line or the IDE

Hope this saves someone a few minutes.

Posted on Friday, August 10, 2007 3:59 PM .net 2 | Back to top


Comments on this post: MsTest Command Line Referenced Assemblies

# re: MsTest Command Line Referenced Assemblies
Requesting Gravatar...
This definitely saved me a few minutes! In my case I was calling classes in one assembly, which loaded classes from another assembly using reflection. MSTest, trying to be too smart did not copy across the assemblies even though they are referenced in the test project.

I think this is a definite case of someone trying to be too clever - if it's referenced in my project, just copy it!

Unfortunately I found this after having spent roughly an hour trying to figure out why &"~@"£" MSTest would not copy my referenced assemblies or it would have saved me more time.

Thanks :-)
Left by Dewang on Dec 04, 2007 6:54 PM

# re: MsTest Command Line Referenced Assemblies
Requesting Gravatar...
Thanks for this, this post nudged me in the right direction!

What worked for me was something slightly different: in my bla.testsettings file which we use for command line test running, I changed the 'root assembly folder' (VS 2010 -> Test menu -> Edit Test Settings -> ... -> Unit Test tab -> Root Folder field) to the current folder (.). This ends up as <AssemblyResolution applicationBaseDirectory="."> in the XML of the bla.testsettings file.
Left by Marnix Klooster on Nov 25, 2012 6:05 PM

# re: MsTest Command Line Referenced Assemblies
Requesting Gravatar...
NICE POST ADMIN THANKS.
mobdro for Windows
xender download app
ASDFSKN ASJDHF
Left by mobdro tv app for pc on May 12, 2017 7:29 PM

Your comment:
 (will show your gravatar)


Copyright © Michael Stephenson | Powered by: GeeksWithBlogs.net