Add Dart test adapter support (Patrol/Flutter)#882
Open
alexks02 wants to merge 2 commits into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a Dart/Flutter JUnit adapter (
src/junit-adapter/dart.js) used for Patrol (LeanCode's Flutter/Dart integration-testing framework) test suites, soreport-xml --lang=dartcan extract source code and TIDs from Dart test files.getFilePath/formatTest: resolves the test's source file and title from Patrol'srunDartTest[tests.path.to.test Test name](Android) /RunnerUITests tests.path.to.test Test name(iOS) title format.fetchSourceCodeinsrc/utils/utils.js) resolves the enclosingvoid main()body instead of matching by test title, since Patrol tests are declared aspTest('title', ($) async { ... })insidemain(), not as named functions/methods — and tracks brace depth to find where that body ends (same approach already used for the C# adapter)..dartis now recognized as a tracked file extension inxmlReader.js's language detection.No new dependencies. All 498 existing unit tests pass