TFS2015 vNext Test name limitation of 257 chars

Have been banging my head for a couple of days now. Trying to figure out what 

"No matching tcm test case result found for test case result given by agent"

actually meaning.

So after digging into the DTAExecutionHost.exe.log and made the same html query as the test agent. I found out that the rest API used by the agent. Chops the full test name after 257 chars. 

This will cause the test agent to have a test that is not found when the test result is going to be published to the TFS server. 

To fix this we simply shorten the test´s name to below 257 chars and the testrun now dint get aborted.

To simplify detecting if someone in the team adds a test with to long name. I wrote a simple test as below.

[TestClass]
public class TFS2015MaxTestNameLengthTest
{
private List<string> _toLongNames;

[TestInitialize]
public void InitTest()
{
var types = this.GetType().Assembly.GetTypes();

_toLongNames = new List<string>();

foreach (var type in types)
{
var methodInfos = type.GetMethods();
foreach (var methodInfo in methodInfos)
{
var customAttributes = methodInfo.GetCustomAttributes(typeof (TestMethodAttribute), true);

if(!customAttributes.Any()) continue;

var name = methodInfo.DeclaringType.FullName + "." + methodInfo.Name;

if(name.Length > 257) _toLongNames.Add(name);
}
}
}

[TestMethod]
[TestCategory("TFS2015Bug")]
public void AllTestMethods_NameToLong_NotFound()
{
Assert.AreEqual(0, _toLongNames.Count,_toLongNames.ValueToString());
}
}

Bug reported:

https://connect.microsoft.com/VisualStudio/feedback/details/2452065

Visningar: 135

Kommentera

Du måste vara medlem i SweNug för att lägga till kommentarer!

Gå med i SweNug

© 2017   Created by Jarle Skogheim.   Drivs med tekniken bakom

Emblem  |  Rapportera en händelse  |  Användarvillkor