Add Android unit tests to plugin template (#120720)

* Add Java tests

* Add Kotlin

* Add integration testing

* Add cerate tests
This commit is contained in:
stuartmorgan
2023-02-15 09:25:23 -08:00
committed by GitHub
parent a664f08a56
commit ef49f5661b
7 changed files with 186 additions and 24 deletions

View File

@@ -2452,6 +2452,63 @@ void main() {
Logger: () => logger,
});
testUsingContext('plugin includes native Kotlin unit tests', () async {
Cache.flutterRoot = '../..';
final CreateCommand command = CreateCommand();
final CommandRunner<void> runner = createTestCommandRunner(command);
await runner.run(<String>[
'create',
'--no-pub',
'--template=plugin',
'--org=com.example',
'--platforms=android',
projectDir.path]);
expect(projectDir
.childDirectory('android')
.childDirectory('src')
.childDirectory('test')
.childDirectory('kotlin')
.childDirectory('com')
.childDirectory('example')
.childDirectory('flutter_project')
.childFile('FlutterProjectPluginTest.kt'), exists);
}, overrides: <Type, Generator>{
FeatureFlags: () => TestFeatureFlags(),
Logger: () => logger,
});
testUsingContext('plugin includes native Java unit tests', () async {
Cache.flutterRoot = '../..';
final CreateCommand command = CreateCommand();
final CommandRunner<void> runner = createTestCommandRunner(command);
await runner.run(<String>[
'create',
'--no-pub',
'--template=plugin',
'--org=com.example',
'--platforms=android',
'-a', 'java',
projectDir.path]);
expect(projectDir
.childDirectory('android')
.childDirectory('src')
.childDirectory('test')
.childDirectory('java')
.childDirectory('com')
.childDirectory('example')
.childDirectory('flutter_project')
.childFile('FlutterProjectPluginTest.java'), exists);
}, overrides: <Type, Generator>{
FeatureFlags: () => TestFeatureFlags(),
Logger: () => logger,
});
testUsingContext('plugin includes native Objective-C unit tests', () async {
Cache.flutterRoot = '../..';