MSTest, why I hate you.... You cause me too much friction (://URLFAN)
Discover what sites bloggers are referencing in real time.
Reading 1,398,771 feeds, parsing 95,631,598 posts, ranking 1,515,000 domains.

    HOME  CONTACT  ABOUT US  TOP 100 SITES  BUZZ POSTS
Search 95,631,598 blog posts
LOOKUP A DOMAIN

Feed
devlicio.us

Post Date
Jul 23, 2008 7:28 a.m.

Article Structure
12 paragraphs
4324 characters
1 images
5 outgoing links

Sites mentioned
(click for rank details):

sourceforge.net
platinumbay.com
lostechies.com
codebetter.com
dimecasts.net


Next Article
Applications - B2 Spice 5.1.8 Electronic Circuit Simulation Software

Previous Article
Giovedì di luglio

MSTest, why I hate you.... You cause me too much friction

Source: http://devlicio.us/blogs/derik_whittaker/archive/2...

Displaying mentions in this article, for full text please visit source.

Yesterday I spent 4+ hours trying to tackle a bug that should not have been a bug in the first place, and the culprit was MSTest.  Please keep in mind that I have never really used MSTest in any real form.  I am a NUnit guy through and through.

Here is some background on what I was trying to do (keep in mind, I have done this numerous times in the past).  I was setting up an application that was going to use the StructureMap Ioc/DI (Version 2.4.9 -- aka 2.5) container.  Because I do not mind using the attributres and StructureMap.config files this was the way I was going to do all the wiring for my container. 

During the testing (via MSTest) of this code, I immediatly ran into an issue with the .config file not being found at runtime.  Now this was odd to me as I could see that the .config file was being copied to the output directly like it should be.  I spent the next 20-30 minutes ensuring that all my code was correct and that the config file was indeed in the right place.

It was not till I was stepping though the current directory was not my /bin folder, but rather TestResultswhitt010_CM4NRG1 2008-07-22 16_18_25out (if you have ever used MSTest you will understand the folder naming convetion).  I found this to be very, very odd.  I did a little digging and realized that for each test run MSTest will create a new folder to run all the tests in (why, I have now figgen clue).  But because my .config file was not a 'normal' file in the eye of MSTest it was not being copied.  Well, my good buddy Steven Andrews was nice enought to help me figure out how to copy the .config file to the correct output folder (post on that forthcoming).  Well, I thought this would solve my issue, but it did not.

Now that I have the .config in the correct test folder (again, not in the bin like ALL the other testing frameworks..why does MS always have to be different) I thought I would be golden.  However, I was still not able to get this working.  After another hour or two of beating my head against the wall, and of bothering both Chad Myers and Jeremy Miller (father of StructureMap).  I finally realized what was going on.  When MSTest runs, it sets the current working directory to c:<InstallBase>Microsoft Visual Studio 9.0Common7IDE because that is where MSTest runs.  Because of this StructureMap was having issues finding the .config file (before you jump to SM as being the issue, think again.  I have done this before both with NUnit and MBUnit and both work fine).

Alas after 4+ hours into my journey I threw in the towel.  I decided that using the StructureMap.config file method with MSTest was just too much friction.  So again with the help of Jeremy and Chad (do not know who was actually typing in the IM window as they were both there) I decided to solve the problem another way.

Here is what I did to get everything working:

  1. Download and use StructureMap 2.4.9 (aka 2.5)
  2. No-longer used the StructureMap.config file.... bye bye my friend
  3. Setup StructureMap to read my config info from my app.config
    1. This involves moving my config info to the app.config
    2. Telling StructureMap how to read from the app.config (blog post on this soon)
  4. Swore over and over again at the pain that MSTest caused me.

In intend to create a few more detaild posts on this over the next few days and will links to them here.

Hope this helps someone.

Till next time,

[----- Remember to check out DimeCasts.Net -----]


Feeds and posts are not affliated with ://URLFAN. They are displayed here simply for informational purposes, if you would like to remove your feed, posts, or domain from ranking and analysis, please contact us.

://URLFAN (.15)
Contact Us - About ://URLFAN - Notify me when my site is added or updated.