Using mstest with partcover

  • dotmonkey

    dotmonkey - 2008-09-27

    Hi all,

    I am trying to to run following test code through mstest and partcover:

        public class Class1
            public int Hello1(int i)
                return i + 1;

            public int Hello2(int i)
                return i + 2;

        public void TestMethod1()
            Class1 o = new Class1();
            Assert.AreEqual(2, o.Hello1(1));
            Assert.AreEqual(4, o.Hello2(2));

    However, somehow partcover kept reporting zero percent usage for Hello1 and Hello2.
    Following is the console output of partcover.

    c:\>"C:\Program Files\Gubka Bob\PartCover .NET 2\PartCover.exe" --target "C:\Program Files
    \Microsoft Visual Studio 9.0\Common7\IDE\MSTest.exe" --target-args "/testcontainer:C:\Work
    space\ConsoleApplication1\TestProject1\bin\Debug\TestProject1.dll" --include "[ClassLibrar
    y3]*" --target-work-dir "C:\Workspace\ConsoleApplication1\TestProject1\bin\Debug"
    Start target
    Wait results
    Microsoft (R) Test Execution Command Line Tool Version 9.0.30729.1
    Copyright (c) Microsoft Corporation. All rights reserved.

    Loading C:\Workspace\ConsoleApplication1\TestProject1\bin\Debug\TestProject1.dll...
    Starting execution...

    Results               Top Level Tests
    -------               ---------------
    Passed                TestProject1.UnitTest1.TestMethod1
    1/1 test(s) Passed

    Test Run Completed.
      Passed  1
      Total   1
    Results file:      C:\Workspace\ConsoleApplication1\TestProject1\bin\Debug\TestResults\Dot Monkey_Machine1 2008-09-28 09_34_24.trx
    Run Configuration: Default Run Configuration
    Walk results
    <?xml version="1.0" encoding="ibm850"?>
    <PartCoverReport ver="">
      <file id="1" url="C:\Workspace\ConsoleApplication1\ClassLibrary3\Class1.cs" />
      <type asm="ClassLibrary3" name="ClassLibrary3.Class1" flags="1048577">
        <method name=".ctor" sig="void  ()" flags="6278" iflags="0">
            <pt visit="0" pos="6" len="1" />
            <pt visit="0" pos="0" len="6" />
        <method name="Hello2" sig="int  (int)" flags="134" iflags="0">
            <pt visit="0" pos="7" len="2" fid="1" sl="18" sc="9" el="18" ec="10" />
            <pt visit="0" pos="1" len="6" fid="1" sl="17" sc="13" el="17" ec="26" />
            <pt visit="0" pos="0" len="1" fid="1" sl="16" sc="9" el="16" ec="10" />
        <method name="Hello1" sig="int  (int)" flags="134" iflags="0">
            <pt visit="0" pos="7" len="2" fid="1" sl="13" sc="9" el="13" ec="10" />
            <pt visit="0" pos="1" len="6" fid="1" sl="12" sc="13" el="12" ec="26" />
            <pt visit="0" pos="0" len="1" fid="1" sl="11" sc="9" el="11" ec="10" />

    Any idea why?
    Thanks in advance.

    • Loginov Oleg

      Loginov Oleg - 2008-09-28

      Please try /noisolation option with mstest

    • dotmonkey

      dotmonkey - 2008-09-29

      It worked, thanks alot oregu.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks