Test locations are missing from test json output when running integration tests on Android
- Dominant language
- Dart
- Stars
- 179k
- Forks
- 31.1k
- PR merge metrics
- PR metrics pending
Description
### Steps to reproduce
1. Create a new Flutter project
2. Copy the `test` folder and rename it to `integration_test`
3. Connect an android device
4. Run the test on the android device and capture the output `flutter test --machine -d pixel .\integration_test\widget_test.dart > logs/android.txt`
5. Run the test on another platform and capture the output `flutter test --machine -d windows .\integration_test\widget_test.dart > logs/windows.txt`
### Expected results
The test JSON output on both should contain the location of the test that ran.
### Actual results
The Windows run has the location (see `root_url`, `root_line`, `root_col`) but the Android run is missing this (only showing the location of the `test()` call that is inside the framework inside `testWidgets()`:
```
Android: {
"test": {
"id": 3,
"name": "Counter increments smoke test",
// ...
// There is no test location here (root_line, root_column, root_url)
"line": 174,
"column": 5,
"url": "package:flutter_test/src/widget_tester.dart"
},
"type": "testStart"
}
Windows: {
"test": {
"id": 3,
"name": "Counter increments smoke test",
// ...
"line": 174,
"column": 5,
"url": "package:flutter_test/src/widget_tester.dart",
"root_line": 14,
"root_column": 3,
"root_url": "file:///D:/Dev/Test%20Projects/dartcode_5922/integration_test/widget_test.dart"
},
"type": "testStart"
}
```
### Code sample
Code sample
The default widget test put inside `integration_test/widget_test.dart` is enough:
```dart
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:dartcode_5922/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(const MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
```
### Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
### Logs
Logs
```console
[Paste your logs here]
```
### Flutter Doctor output
Doctor output
## Android
```js
{"protocolVersion":"0.1.1","runnerVersion":null,"pid":19580,"type":"start","time":0}
{"suite":{"id":0,"platform":"vm","path":"D:/Dev/Test Projects/dartcode_5922/integration_test/widget_test.dart"},"type":"suite","time":0}
{"test":{"id":1,"name":"loading D:/Dev/Test Projects/dartcode_5922/integration_test/widget_test.dart","suiteID":0,"groupIDs":[],"metadata":{"skip":false,"skipReason":null},"line":null,"column":null,"url":null},"type":"testStart","time":0}
{"count":1,"time":2,"type":"allSuites"}
√ Built build\app\outputs\flutter-apk\app-debug.apk
[{"event":"test.startedProcess","params":{"vmServiceUri":"http://127.0.0.1:64609/EzMyt2yt5AI=/"}}]
{"testID":1,"result":"success","skipped":false,"hidden":true,"type":"testDone","time":12783}
{"group":{"id":2,"suiteID":0,"parentID":null,"name":"","metadata":{"skip":false,"skipReason":null},"testCount":1,"line":null,"column":null,"url":null},"type":"group","time":12784}
{"test":{"id":3,"name":"Counter increments smoke test","suiteID":0,"groupIDs":[2],"metadata":{"skip":false,"skipReason":null},"line":174,"column":5,"url":"package:flutter_test/src/widget_tester.dart"},"type":"testStart","time":12784}
{"testID":3,"result":"success","skipped":false,"hidden":false,"type":"testDone","time":14455}
{"test":{"id":4,"name":"(tearDownAll)","suiteID":0,"groupIDs":[2],"metadata":{"skip":false,"skipReason":null},"line":50,"column":5,"url":"package:integration_test/integration_test.dart"},"type":"testStart","time":14457}
{"testID":4,"result":"success","skipped":false,"hidden":true,"type":"testDone","time":14473}
{"success":true,"type":"done","time":14807}
```
## Windows
```js
{"protocolVersion":"0.1.1","runnerVersion":null,"pid":9068,"type":"start","time":0}
{"suite":{"id":0,"platform":"vm","path":"D:/Dev/Test Projects/dartcode_5922/integration_test/widget_test.dart"},"type":"suite","time":0}
{"test":{"id":1,"name":"loading D:/Dev/Test Projects/dartcode_5922/integration_test/widget_test.dart","suiteID":0,"groupIDs":[],"metadata":{"skip":false,"skipReason":null},"line":null,"column":null,"url":null},"type":"testStart","time":0}
{"count":1,"time":2,"type":"allSuites"}
√ Built build\windows\x64\runner\Debug\dartcode_5922.exe
[{"event":"test.startedProcess","params":{"vmServiceUri":"http://127.0.0.1:64636/A1_Qm2zBYO4=/"}}]
{"testID":1,"result":"success","skipped":false,"hidden":true,"type":"testDone","time":9072}
{"group":{"id":2,"suiteID":0,"parentID":null,"name":"","metadata":{"skip":false,"skipReason":null},"testCount":1,"line":null,"column":null,"url":null},"type":"group","time":9073}
{"test":{"id":3,"name":"Counter increments smoke test","suiteID":0,"groupIDs":[2],"metadata":{"skip":false,"skipReason":null},"line":174,"column":5,"url":"package:flutter_test/src/widget_tester.dart","root_line":14,"root_column":3,"root_url":"file:///D:/Dev/Test%20Projects/dartcode_5922/integration_test/widget_test.dart"},"type":"testStart","time":9074}
{"testID":3,"result":"success","skipped":false,"hidden":false,"type":"testDone","time":9459}
{"test":{"id":4,"name":"(tearDownAll)","suiteID":0,"groupIDs":[2],"metadata":{"skip":false,"skipReason":null},"line":50,"column":5,"url":"package:integration_test/integration_test.dart"},"type":"testStart","time":9459}
{"testID":4,"result":"success","skipped":false,"hidden":true,"type":"testDone","time":9462}
{"success":true,"type":"done","time":9467}
```
Contributor guide
Assessment
This issue has not been assessed yet.