Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parser changes for test results #4974

Merged
merged 10 commits into from
Sep 6, 2024
Merged
1 change: 1 addition & 0 deletions src/Agent.Sdk/Agent.Sdk.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
<PackageReference Include="System.Private.Uri" Version="4.3.2" />
<PackageReference Include="System.Formats.Asn1" Version="8.0.1" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.3.1" />
</ItemGroup>
</Project>
16 changes: 11 additions & 5 deletions src/Agent.Worker/TestResults/Parser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ protected override ITestResultParser GetTestResultParser(IExecutionContext execu
var traceListener = new CommandTraceListener(executionContext);
var featureFlagService = executionContext.GetHostContext().GetService<IFeatureFlagService>();
var enableJunitAttachments = featureFlagService.GetFeatureFlagState(TestResultsConstants.JUnitTestCaseAttachmentsEnabled, TestResultsConstants.TCMServiceInstanceGuid);
return new JUnitResultParser(traceListener, false, enableJunitAttachments);
bool enableCustomTestFields = featureFlagService.GetFeatureFlagState(TestResultsConstants.CustomTestFieldsInPTRInputFilesEnabled, TestResultsConstants.TCMServiceInstanceGuid);
return new JUnitResultParser(traceListener, false, enableJunitAttachments,enableCustomTestFields);
}
}

Expand All @@ -86,7 +87,9 @@ public class XUnitParser : Parser, IParser
protected override ITestResultParser GetTestResultParser(IExecutionContext executionContext)
{
var traceListener = new CommandTraceListener(executionContext);
return new XUnitResultParser(traceListener);
var featureFlagService = executionContext.GetHostContext().GetService<IFeatureFlagService>();
bool enableCustomTestFields = featureFlagService.GetFeatureFlagState(TestResultsConstants.CustomTestFieldsInPTRInputFilesEnabled, TestResultsConstants.TCMServiceInstanceGuid);
return new XUnitResultParser(traceListener, setNameAsDisplayName: false, isTestCaseParallelReportingEnabled: false, enableCustomTestFields);
}

}
Expand All @@ -101,7 +104,8 @@ protected override ITestResultParser GetTestResultParser(IExecutionContext execu
var traceListener = new CommandTraceListener(executionContext);
var featureFlagService = executionContext.GetHostContext().GetService<IFeatureFlagService>();
var enableXUnitHeirarchicalParsing = featureFlagService.GetFeatureFlagState(TestResultsConstants.EnableXUnitHeirarchicalParsing, TestResultsConstants.TFSServiceInstanceGuid);
return new TrxResultParser(traceListener, enableXUnitHeirarchicalParsing);
bool enableCustomTestFields = featureFlagService.GetFeatureFlagState(TestResultsConstants.CustomTestFieldsInPTRInputFilesEnabled, TestResultsConstants.TCMServiceInstanceGuid);
return new TrxResultParser(traceListener, enableXUnitHeirarchicalParsing, enableCustomTestFields);
}

}
Expand All @@ -114,7 +118,9 @@ public class NUnitParser : Parser, IParser
protected override ITestResultParser GetTestResultParser(IExecutionContext executionContext)
{
var traceListener = new CommandTraceListener(executionContext);
return new NUnitResultParser(traceListener);
var featureFlagService = executionContext.GetHostContext().GetService<IFeatureFlagService>();
bool enableCustomTestFields = featureFlagService.GetFeatureFlagState(TestResultsConstants.CustomTestFieldsInPTRInputFilesEnabled, TestResultsConstants.TCMServiceInstanceGuid);
return new NUnitResultParser(traceListener, isTestCaseParallelReportingEnabled: false, enableCustomTestFields);
}

}
Expand Down Expand Up @@ -143,4 +149,4 @@ protected override ITestResultParser GetTestResultParser(IExecutionContext execu
return new ContainerStructureTestResultParser(traceListener);
}
}
}
}
2 changes: 2 additions & 0 deletions src/Agent.Worker/TestResults/Utils/TestResultsConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,7 @@ public class TestResultsConstants
public static readonly string JUnitTestCaseAttachmentsEnabled = "TestManagement.Server.JUnitTestCaseAttachmentsEnabled";

public static readonly string EnableAzureTestPlanTaskFeatureFlag = "TestManagement.Server.EnableAzureTestPlanTaskFlow";

public static readonly string CustomTestFieldsInPTRInputFilesEnabled = "TestManagement.Server.CustomTestFieldsInPTRInputFilesEnabled";
}
}
2 changes: 1 addition & 1 deletion src/Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<OSPlatform>OS_UNKNOWN</OSPlatform>
<OSArchitecture>ARCH_UNKNOWN</OSArchitecture>
<DebugConstant></DebugConstant>
<VssApiVersion>0.5.238-private</VssApiVersion>
<VssApiVersion>0.5.245-private</VssApiVersion>
<CodeAnalysis>$(CodeAnalysis)</CodeAnalysis>
<InvariantGlobalization>false</InvariantGlobalization>
<EnforceCodeStyleInBuild>false</EnforceCodeStyleInBuild>
Expand Down
Loading