Skip to content

Add Dart test adapter support (Patrol/Flutter)#882

Open
alexks02 wants to merge 2 commits into
testomatio:2.xfrom
alexks02:dart-adapter-pr
Open

Add Dart test adapter support (Patrol/Flutter)#882
alexks02 wants to merge 2 commits into
testomatio:2.xfrom
alexks02:dart-adapter-pr

Conversation

@alexks02

Copy link
Copy Markdown

Adds a Dart/Flutter JUnit adapter (src/junit-adapter/dart.js) used for Patrol (LeanCode's Flutter/Dart integration-testing framework) test suites, so report-xml --lang=dart can extract source code and TIDs from Dart test files.

  • getFilePath/formatTest: resolves the test's source file and title from Patrol's runDartTest[tests.path.to.test Test name] (Android) / RunnerUITests tests.path.to.test Test name (iOS) title format.
  • Source-code extraction (fetchSourceCode in src/utils/utils.js) resolves the enclosing void main() body instead of matching by test title, since Patrol tests are declared as pTest('title', ($) async { ... }) inside main(), not as named functions/methods — and tracks brace depth to find where that body ends (same approach already used for the C# adapter).
  • .dart is now recognized as a tracked file extension in xmlReader.js's language detection.

No new dependencies. All 498 existing unit tests pass

Adds a Dart/Flutter JUnit adapter (src/junit-adapter/dart.js) used for
Patrol (LeanCode's Flutter/Dart integration-testing framework) test
suites, so report-xml can extract source code and TIDs from Dart test
files (--lang=dart):
- resolves the enclosing void main() body instead of matching by test
  title, since Patrol tests are declared as pTest('title', ($) async
  { ... }) inside main(), not as named functions/methods
- tracks brace depth to find where that body ends (same approach
  already used for the C# adapter)
- recognizes .dart as a tracked file extension in xmlReader.js's
  language detection
- Locate the Dart test's patrolTest/testWidgets block by title before
  falling back to main(), so multiple annotated tests in one file no
  longer share the same @t comment/test ID.
- Detect Android vs iOS tests via the runDartTest[ prefix instead of a
  bare '[' check, which misclassified parameterized iOS titles.
- Extract Android t.file from the title (matching getFilePath) instead
  of the truncated suite_title, so reported paths match actual files.
- Use one regex for param detection and replacement so brackets without
  a leading ": " are handled and multi-param titles stay aligned.
- Drop the unused t.originalTitle.
- Add unit tests covering all of the above.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant