Skip to content

[MTP CLI Analysis] report-html-filename and report-trx-filename expose incompatible path semantics #8428

@Evangelink

Description

@Evangelink

Summary

--report-html-filename and --report-trx-filename use nearly identical naming, but they expose materially different path semantics. TRX accepts bare names, relative paths, absolute paths, and placeholders; HTML rejects any path component and only accepts a pure file name.

Evidence

  • src/Platform/Microsoft.Testing.Extensions.HtmlReport/HtmlReportGeneratorCommandLine.cs:45-50

    // Validate "pure file name" first. We don't want any path component...
    if (!IsValidPureFileName(fileName)) { return ValidationResult.InvalidTask(ExtensionResources.HtmlReportFileNameShouldNotContainPath); }

  • src/Platform/Microsoft.Testing.Extensions.HtmlReport/HtmlReportEngine.cs:65-70

    string fileName = fileNameExplicitlyProvided ? providedFileName![0] : BuildDefaultFileName(finishTime);
    string finalPath = Path.Combine(outputDirectory, fileName);

  • src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxCommandLine.cs:45-48

    // We accept relative or absolute paths...
    string fileNamePart = Path.GetFileName(argument);

  • src/Platform/Microsoft.Testing.Extensions.TrxReport/TrxReportEngine.cs:97-103,147-154

    The argument may be a bare file name, a relative path or an absolute path. Placeholders are resolved first...
    Path.Combine short-circuits when the second argument is rooted...
    _fileSystem.CreateDirectory(finalDirectory);

  • est/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoAllExtensionsTests.cs:128-137

--report-html-filename / The name of the generated HTML report
--report-trx-filename / May include a relative or absolute path... Supports the following placeholders...

Why this is a real issue

These options look like siblings in the same
eport-* family, so users naturally transfer syntax between them. A command shape such as --report-trx-filename artifacts\run.trx works, but the analogous --report-html-filename artifacts\run.html is rejected during validation. That is a real CLI consistency problem, not just a stylistic difference.

Suggested resolution

Align the two options' filename semantics, or make the divergence explicit in naming and help text. If HTML intentionally must stay results-directory-relative, consider either supporting the same path features as TRX or renaming/documenting it so users do not assume the same contract.

Related issues

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions