Getting the dreaded "The fully qualified file name must be less than 260 characters" when publishing test results in TFS 2008
During the last week I've had some issues with getting an old set of tests to run in the automated build process. The reason they had been excluded before was that the author had used .xml files to drive his test suite and was unaware of the functionality in MSTest that let's us specify deployment items through the .testrunconfig file (provided that you run you tests using a .vsmdi file).
Anyway, even though I don't particularly fancy the approach of using external files to drive the test (there are good scenarios but in my opinion they should be oriented more towards simple parameter driving of test not complex object serialization, but that is a post in itself if I get around to it sometime).
The problem once I got the test to run on the server (some shmuck had deselected the deploy alternative for the assembly containing the unit tests in the build targeted by the automated build), that the testrun results simply wouldn’t publish instead we got this message in the log:
Waiting to publish... Publishing results of test run tfsservice@LIVMSRV228 2009-08-21 12:56:49_Any CPU_Release to http://livmsrv246:8080/Build/v1.0/PublishTestResultsBuildService2.asmx... ....The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters. The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters. MSBUILD : warning MSB6006: "MSTest.exe" exited with code 1.
What happened was that the tests ran ok and you’d see the results ok in the log but as soon as Team Build tried to publish the results we ended up with a complaint about a too long path. Unfortunately no matter what amount of logging you switch on the log won’t tell you which file is the problem and in our case this particular test result file was actually on of the shorter paths :). So after a fair amount of head-butting I managed to get it working and guess what the problem resided in the deployment items that we selected using the .testrunconfig. Our structure was heavily nested with long self-explanatory names for readability :) which is good, but since they somehow are involved in the publishing step (I haven’t had the time to drill down into what happens here so if you have some insight into this feel free to comment about it) and thus you are restricted to the 260 characters for the fully qualified path name of the deployment item.