Answered Running tests as part of the build

  • Friday, September 21, 2012 1:24 PM
     
      Has Code

    Hi,

    I have a two build controllers and each has 5 agents. I created new build definition to build my project and run tests. If I run build in a first controller it works fine, I will get all the results from tests, but if I switch to a second controller it is not finishing the build.

    It is not doing anything after Starting Execution. Test cases are very simple.

    [TestMethod]
    public void Method1()
    {
         Assert.AreEqual("A","A");
    }

    Thanks for help!


    Dilshod

All Replies

  • Monday, September 24, 2012 5:59 AM
    Moderator
     
     

    Hi Dilshod,

    Thanks for your post.

    If your TFS version is 2010, I suggest you upgrade your TFS 2010 to TFS 2010 SP1, and upgrade the VS 2010 to VS 2010 SP1 too. 

    When running test failed during Team Build, please check the Configuration in your Build Definition, when you set Release|Any CPU, will this issue occur again?

    Will other build definition encounter this issue too? If you specify to the test .vsmdi file, will this issue occur again?

    Logon on the build machine(the using build agent machine under your second controller), then run your test project using the MSTest command manually, can execute the test correctly?  


    John Qiao [MSFT]
    MSDN Community Support | Feedback to us

  • Tuesday, September 25, 2012 8:43 AM
    Moderator
     
     

    Hi Dilshod, 

    If misunderstood anything, please describe your question in more detail and we will be able to provide the better responses.


    John Qiao [MSFT]
    MSDN Community Support | Feedback to us

  • Tuesday, September 25, 2012 4:10 PM
     
     

    Hi John Qiao,

    I can't change build definition to Release|AnyCPU. Because some of my projects are x86. Even I can't change all my projects to AnyCPU(I don't know why. Visual Studio doesn't allow me to change it). If I change to Release| AnyCPU it is not building all of my projects. 

    By the way. My both OSs are 64 bit OS and second machine is virtual.


    Dilshod

  • Tuesday, September 25, 2012 6:44 PM
     
     

    Hi,

    I am not sure whether my suggestion is the actual solution for the last reply in this thread.

    If you open the solution properties (Right click on solution and select Properties), you can change the platform to x86 or AnyCPU and even you can specify which project you want to build. And regarding 64-bit OS, as far my knowledge goes, i dont think the project platform has to do anything with the build controller OS version (in fact, build controllers needs to be 64-bit OS i guess).

    Sorry if any of my information above is incorrect.


    Thanks, Pratap

  • Tuesday, September 25, 2012 8:19 PM
     
     

    Hi Pratap,

    I am agree with you. It works fine if I run just build without test. If I enable tests as a part of the build build never finish.

    I am writing this again. I have two controllers in a different machines(second one is virtual machine). It runs fine if I run build on a first controller with tests. In second machine(virtual) never finishes if I enable tests.

    Thanks,


    Dilshod

  • Wednesday, September 26, 2012 2:35 AM
    Moderator
     
     

    Hi Dilshod, 

    Thanks for your reply.

    As I said, please logon on your second build machine, try to execute your test project using MSTest.exe command manually, ensure it can be executed correctly. TFS Build invoke MSTest.exe to run the test on build machine, if you can execute the test using MSTest.exe on build machine manually, so I think TFS Build can run the test too.  


    John Qiao [MSFT]
    MSDN Community Support | Feedback to us

  • Wednesday, September 26, 2012 11:21 AM
     
     

    Hi John Qiao,

    I tried to run from command line on that machine. It hangs on Starting execution... and nothing after that.

    Thanks,


    Dilshod

    This is the command I am running from command line.

    "c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe" /nologo /usestderr /searchpathroot:"C:\Builds\9\?????????????\EF_build\Binaries" /resultsfileroot:"C:\Builds\9\?????????????\EF_build\TestResults" /testcontainer:"C:\Builds\9\??????????????\EF_build\Binaries\??????????????UnitTests.dll" /publish:"http://??????????:8080/tfs/???????????????????" /publishbuild:"vstfs:///Build/Build/250" /teamproject:"????????????????" /platform:"Mixed Platforms" /flavor:"Release"

    I attached VS to process and got this output.

    'MSTest.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'MSTest.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'MSTest.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'MSTest.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.Common\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.Common.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'MSTest.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'MSTest.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.ExecutionCommon\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.ExecutionCommon.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'MSTest.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.Resource\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.Resource.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'MSTest.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'MSTest.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'MSTest.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.CommandLine\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.CommandLine.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'MSTest.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.TMI\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.TMI.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'MSTest.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'MSTest.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0__b77a5c561934e089\System.Numerics.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'MSTest.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\System.Web\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'MSTest.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Tip\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.Tips.UnitTest.Tip.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'MSTest.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.QualityTools.Tips.OrderedTest.Tip.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'MSTest.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'MSTest.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.UnitTestFramework\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'MSTest.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.Tips.UnitTest.AssemblyResolver\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.Tips.UnitTest.AssemblyResolver.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'MSTest.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.ControllerObject\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.ControllerObject.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'MSTest.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.AgentProcessManager\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.AgentProcessManager.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'MSTest.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Remoting\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Remoting.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'MSTest.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.Common\11.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.Common.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    The thread '<No Name>' (0x1bc) has exited with code 0 (0x0).

    _______________________________________________________________________

    Last line "The thread '<No Name>' (0x1bc) has exited with code 0 (0x0)." keeps going.

    Thanks again,


    • Edited by dkcorp Wednesday, September 26, 2012 11:55 AM adding some more things
    • Edited by dkcorp Wednesday, September 26, 2012 11:56 AM
    •  
  • Wednesday, September 26, 2012 6:16 PM
     
     Answered

    I fixed this problem by adding command line argument "/noisolation". Now I am able to run tests as a part of the build, but I don't know what happens if I add some more test cases which uses app.config or something else. Let me know if there is better way of doing this.

    Thanks,


    Dilshod

    • Marked As Answer by dkcorp Thursday, September 27, 2012 12:16 PM
    •  
  • Thursday, September 27, 2012 2:39 AM
    Moderator
     
     

    Hi Dilshod,

    Thanks for your post.

    To run test case during Team Build, we should ensure the test case can be executed using MSTest.exe command on build machine first.

    If there has any issue with execute your test cases using MSTest.exe command, or has any issue with MSTest.exe command when you add some more test cases which use app.config or something else, please post it at VS Unite Testing forum for the better response.  


    John Qiao [MSFT]
    MSDN Community Support | Feedback to us

  • Thursday, September 27, 2012 12:15 PM
     
     

    Hi John Qiao,

    Thanks for advice! :-)


    Dilshod