locked
Inline Code Coverage analysis runs in Visual Studio 2008 and fails in Visual Studio 2010 RRS feed

  • Question

  • Hello,
    Before I was using Microsoft Visual Studio Ultimate 2008 on Windows XP Service Pack3.
    I've developped a class for inline coverage analysis that was executed in maintenance build each night.

    public class TestCoverageAnalyst
    {
        Monitoring monitor;
            public string TestAssemblyName { get; set; }

         /// <summary>
        /// create a new Monitor and start run coverage monitor
        /// </summary>
        private void InitCoverageMonitor(string outputFileName) {...}

         /// <summary>
        /// start a new process vsinstr.exe /COVERAGE
            /// </summary>
        private void InstrumentAssembly(string assemblyFilePath) {...}

         /// <summary>
        /// finish run coverage monitor
            /// </summary>
        private void EndCoverageMonitor() {...}

         /// <summary>
        /// call InstrumentAssembly for each assembly
            /// </summary>
        public void InstrumentAssemblies(List<string> assembliesPath) {...}

         /// <summary>
        /// create a new process using mstest.exe to run all tests for specific
        /// class located in assembly TestAssemblyName with AssemblyFilePath
            /// </summary>   
        public void RunTests(string fullTestClassName, string outputFileName) {...}

            /// <summary>
        /// create a new process using mstest.exe to run all tests
        /// from assembly TestAssemblyName with AssemblyFilePath
            /// </summary>
        public void RunTests(string outputFileName) {...}
    }

    The output file coverage was correctely generated.
    Since I used Visual Studio 2010 Ultimate on Windows XP Service Pack3, the output file is still generated with a correct field "ClassName" but zero value for the other fields (LinesCovered and TotalLines).

    Can any one help me ? Thanks for answer.
    Tuesday, January 25, 2011 2:23 PM

All replies

  • Hi,

    Not really sure about your issue but if you looking to get the code coverage on daily builds, you can achieve that fairly easily with TFS 2010.

    Refer http://www.codewrecks.com/blog/index.php/2010/06/14/running-code-coverage-in-tfs2010-builds/

    Thanks,

    Anuj

    Tuesday, January 25, 2011 6:02 PM
  • Anuj,

    Thanks for your answer.

    In fact I want to generate code coverage in a file that I first transform in xml and next in xls. So in Visual Studio 2008 I needed to create a specific application. When I changed Visual Studio from 2008 to 2010, I tried to use the same application. That was ok in 2008, but failed in 2010 (all code coverage files have the same size, and fields LinesCovered and TotalLines are set to zero).

    Have an idea ?

    Thanks.

    Wednesday, January 26, 2011 2:42 PM