Skip to content

Commit b068c39

Browse files
collinjacksonmormih
authored andcommitted
[instrumentation_adapter] Update README instructions (flutter#2022)
(documentation-only change)
1 parent 87248b0 commit b068c39

3 files changed

Lines changed: 30 additions & 2 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.0.2
2+
3+
* Document current usage instructions, which require adding a Java test file.
4+
15
## 0.0.1
26

37
* Initial release

packages/instrumentation_adapter/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,30 @@ void main() {
2222
}
2323
```
2424

25+
Create an instrumentation test file in your application's
26+
android/app/src/androidTest/java/com/example/myapp/ directory
27+
(replacing com, example, and myapp with values from your app's
28+
package name). You can name this test file MainActivityTest.java
29+
or another name of your choice.
30+
31+
```
32+
package com.example.myapp;
33+
34+
import androidx.test.rule.ActivityTestRule;
35+
import dev.flutter.plugins.instrumentationadapter.FlutterRunner;
36+
import dev.flutter.plugins.instrumentationadapter.FlutterTest;
37+
import java.lang.Override;
38+
import org.junit.runner.RunWith;
39+
40+
@RunWith(FlutterRunner.class)
41+
public class MainActivityTest extends FlutterTest {
42+
@Override
43+
public void launchActivity() {
44+
ActivityTestRule<MainActivity> rule = new ActivityTestRule<>(MainActivity.class);
45+
rule.launchActivity(null);
46+
}
47+
}```
48+
2549
Use gradle commands to build an instrumentation test for Android.
2650
2751
```

packages/instrumentation_adapter/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: instrumentation_adapter
22
description: Runs tests that use the flutter_test API as platform native instrumentation tests.
3-
version: 0.0.1
3+
version: 0.0.2
44
author: Flutter Team <flutter-dev@googlegroups.com>
55
homepage: https://github.com/flutter/plugins/tree/master/packages/instrumentation_adapter
66

@@ -16,4 +16,4 @@ dependencies:
1616
flutter:
1717
plugin:
1818
androidPackage: dev.flutter.plugins.instrumentationadapter
19-
pluginClass: InstrumentationAdapterPlugin
19+
pluginClass: InstrumentationAdapterPlugin

0 commit comments

Comments
 (0)