🫴 Proposal
Introduce support for custom attributes in JUnit XML reports generated by TeaPie. This feature would allow TeaPie to output additional metadata for each <testcase> element in the JUnit XML—such as the source of the test (inline vs. .csx) and, for inline tests, a reference to the related HTTP request name. These attributes will enable better integration with external tools (such as IDE extensions) that visualize test results in the context of the HTTP requests they belong to.
Example attributes:
source="inline" or source="csx"
request="EditCarRequest" (for inline tests)
Example output:
<testcase name="[1] Status code should match one of these: [200, 201]" time="0.003" classname="002-Edit-Car" source="inline" request="EditCarRequest" />
<testcase name="Engine type and people capacity should match after edit." time="0.006" classname="002-Edit-Car" source="csx" />
✨ Motivation
When integrating TeaPie with external tools (such as custom IDE extensions for HTTP workflows), it's necessary and useful to distinguish between inline tests (defined in .http files and attached to specific requests) and tests defined in .csx scripts. Currently, the JUnit XML output does not provide this information, making it unreliable to group or filter test results in these visual tools. Adding such attributes should be safe and non-breaking, as unknown XML attributes should be ignored by JUnit XML consumers (including CI/CD tools like GitHub Actions).
💡 Possible implementation
Based on the current TeaPie codebase:
- Extend the
TestResult model to include optional metadata fields such as SourceType (string: "inline" or "csx") and RequestName (string, nullable).
- Pass these fields through the reporting pipeline: When calling
RegisterTestResult in TestResultsSummaryReporter, ensure these fields are set for each test.
- Update the XML output logic in
src/TeaPie/Reporting/JUnitXmlTestResultsSummaryReporter.cs and especially the JUnitXmlWriter:
- Update the writer so that
WriteTestCase can accept and emit these custom attributes when writing the <testcase> XML node.
- For
.csx tests, default to source="csx" and omit the request attribute.
- For inline tests (from HTTP files), include both
source="inline" and the request attribute.
Example change to the writer's API:
writer.WriteTestCase(
className,
testName,
duration,
isSkipped,
errorMessage,
stackTrace,
sourceType: "inline" or "csx",
requestName: "EditCarRequest" // only for inline tests
);
And in the XML generation:
writer.WriteAttribute("source", sourceType);
if (!string.IsNullOrEmpty(requestName)) {
writer.WriteAttribute("request", requestName);
}
➕ Additional context
This feature enables richer integrations for developer tools (such as VS Code extensions) that visualize requests and their associated tests, improving the user experience for TeaPie users working with complex API suites.
References:
🫴 Proposal
Introduce support for custom attributes in JUnit XML reports generated by TeaPie. This feature would allow TeaPie to output additional metadata for each
<testcase>element in the JUnit XML—such as the source of the test (inlinevs..csx) and, for inline tests, a reference to the related HTTP request name. These attributes will enable better integration with external tools (such as IDE extensions) that visualize test results in the context of the HTTP requests they belong to.Example attributes:
source="inline"orsource="csx"request="EditCarRequest"(for inline tests)Example output:
✨ Motivation
When integrating TeaPie with external tools (such as custom IDE extensions for HTTP workflows), it's necessary and useful to distinguish between inline tests (defined in
.httpfiles and attached to specific requests) and tests defined in.csxscripts. Currently, the JUnit XML output does not provide this information, making it unreliable to group or filter test results in these visual tools. Adding such attributes should be safe and non-breaking, as unknown XML attributes should be ignored by JUnit XML consumers (including CI/CD tools like GitHub Actions).💡 Possible implementation
Based on the current TeaPie codebase:
TestResultmodel to include optional metadata fields such asSourceType(string: "inline" or "csx") andRequestName(string, nullable).RegisterTestResultinTestResultsSummaryReporter, ensure these fields are set for each test.src/TeaPie/Reporting/JUnitXmlTestResultsSummaryReporter.csand especially theJUnitXmlWriter:WriteTestCasecan accept and emit these custom attributes when writing the<testcase>XML node..csxtests, default tosource="csx"and omit therequestattribute.source="inline"and therequestattribute.Example change to the writer's API:
And in the XML generation:
➕ Additional context
This feature enables richer integrations for developer tools (such as VS Code extensions) that visualize requests and their associated tests, improving the user experience for TeaPie users working with complex API suites.
References: