The solution is to remove the Items property from the derived classes ( CodedWebTestElementType and GenericTestType ), and also move the serialization attributes to the base class so as not to miss the values if you have a coded web test or general test.
IOW, the solution is as follows.
First remove the Items property from CodedWebTestElementType type
/// <remarks/> [System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://microsoft.com/schemas/VisualStudio/TeamTest/2010")] public partial class CodedWebTestElementType : BaseTestType { }
Then move the two XmlElementAttribute attributes to the BaseTestType base class (see the last two):
/// <remarks/> [System.Xml.Serialization.XmlElementAttribute("Agent", typeof(BaseTestTypeAgent))] [System.Xml.Serialization.XmlElementAttribute("Css", typeof(BaseTestTypeCss))] [System.Xml.Serialization.XmlElementAttribute("DeploymentItems", typeof(BaseTestTypeDeploymentItems))] [System.Xml.Serialization.XmlElementAttribute("Description", typeof(object))] [System.Xml.Serialization.XmlElementAttribute("Execution", typeof(BaseTestTypeExecution))] [System.Xml.Serialization.XmlElementAttribute("Owners", typeof(BaseTestTypeOwners))] [System.Xml.Serialization.XmlElementAttribute("Properties", typeof(BaseTestTypeProperties))] [System.Xml.Serialization.XmlElementAttribute("TcmInformation", typeof(TcmInformationType))] [System.Xml.Serialization.XmlElementAttribute("TestCategory", typeof(BaseTestTypeTestCategory))] [System.Xml.Serialization.XmlElementAttribute("WorkItemIDs", typeof(WorkItemIDsType))] [System.Xml.Serialization.XmlElementAttribute("IncludedWebTests", typeof(CodedWebTestElementTypeIncludedWebTests))] [System.Xml.Serialization.XmlElementAttribute("WebTestClass", typeof(CodedWebTestElementTypeWebTestClass))] public object[] Items { get { return this.itemsField; } set { this.itemsField = value; } }
After that, do the same for the GenericTestType class.
This way you will not lose information if you receive IncludedWebTests , WebTestClass , command or SummaryXmlFile nodes one day.
source share