I have been doing some more work integrating Typemock and VS 2010 Team Build. I have just wasted a good few hours wondering why my test results are not being published.
If I looked at the build log I saw my tests ran (and pass or failed as expected) and then were published without error.
But when I checked the build summary it said there were no tests associated with the build, it reporting “No Test Results”
This was strange it had been working in the past. After much fiddling around I found the problem, it was twofold:
- The main problems was that in my InvokeMethod call to run Typemock/MSTest I had hard coded the Platform: and Flavor: values. This meant irrespective of the build I asked for, I published my test results to the Any CPU|Debug configurations. MSTest lets you do this, even if no build of that configuration exists at the time.
My InvokeMethod argument parameter should be been something like
“““C:Program Files (x86)Microsoft Visual Studio 10.0Common7IDEMSTest.exe”” /nologo /testcontainer:”"" + String.Format("{0}BinariesBusinessLogic.Tests.dll", BuildDirectory) + """ /publish:""http://typhoon:8080/tfs/DefaultCollection"" /publishbuild:""" + BuildDetail.Uri.ToString() + """ /teamproject:""" + BuildDetail.TeamProject + """ /platform:""" + platformConfiguration.Platform + """ /flavor:""" + platformConfiguration.Configuration + """ /resultsfile:""" + String.Format("{0}BinariesTest.Trx", BuildDirectory) + """ "
- The second issues was that I had failed, on at least one of my test build definitions, to set the Configurations to Build setting. This meant the build defaulted to Mixed Platforms|Debug (hence not matching my hard coded Any CPU|Debug configuration). Interesting to note here if that the parameters used above (platformConfiguration.Configuration and platformConfiguration.Platform ) are both empty if the Configurations to Build setting is not set. MSBuild is the activity that chooses the defaults not the workflow. So in effect you must always set these values for your build, or you will need to handle these empty strings in the workflow if you don’t want MSTest to fail saying the Platforms and Flavour parameters are empty. Seem to me explicitly setting them is good practice anyway.
So the technical tip here is make sure that you correctly us all the parameters associated with a workflow in activities. You cannot trust an activity to give and error or warning if you pass it strange values.