Skip to content

[Test Improver] Add unit tests for ResponseFileHelper.SplitCommandLine #8300

@Evangelink

Description

@Evangelink

🤖 Test Improver — automated AI assistant

Goal and Rationale

ResponseFileHelper.SplitCommandLine is a non-trivial state-machine tokenizer that handles quoted strings with embedded spaces, mixed quote/unquoted tokens, whitespace normalization, and tab separators. It has no dedicated unit tests today. Bugs here could silently corrupt response-file arguments passed to MTP.

Approach

Added 14 test cases covering:

  • Empty and whitespace-only input → empty result
  • Single and multiple unquoted tokens
  • Leading/trailing/multiple whitespace between tokens
  • Quoted strings with embedded spaces → single token (quotes stripped)
  • Mixed quoted + unquoted tokens
  • Tab as delimiter
  • Real-world response-file line: --filter "FullyQualifiedName~..." --timeout 60

Test Status

All 28 tests pass (14 × net8.0 + net9.0):

Test run summary: Passed!
  total: 28  failed: 0  succeeded: 28  skipped: 0

Reproducibility

dotnet test test/UnitTests/Microsoft.Testing.Platform.UnitTests/Microsoft.Testing.Platform.UnitTests.csproj \
  -c Debug --filter "ResponseFileHelperTests"

Generated by Daily Test Improver · ● 13.4M ·


Note

This was originally intended as a pull request, but the git push operation failed.

Workflow Run: View run details and download bundle artifact

The bundle file is available in the agent artifact in the workflow run linked above.

To create a pull request with the changes:

# Download the artifact from the workflow run
gh run download 25983857280 -n agent -D /tmp/agent-25983857280

# Fetch the bundle into a local branch
git fetch /tmp/agent-25983857280/aw-test-assist-response-file-helper-tests.bundle refs/heads/test-assist/response-file-helper-tests:refs/heads/test-assist/response-file-helper-tests-004d52984fdd738c
git checkout test-assist/response-file-helper-tests-004d52984fdd738c

# Push the branch to origin
git push origin test-assist/response-file-helper-tests-004d52984fdd738c

# Create the pull request
gh pr create --title '[Test Improver] Add unit tests for ResponseFileHelper.SplitCommandLine' --base main --head test-assist/response-file-helper-tests-004d52984fdd738c --repo microsoft/testfx

Metadata

Metadata

Assignees

No one assigned

    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