Add Android unit tests to plugin template (#120720)
* Add Java tests * Add Kotlin * Add integration testing * Add cerate tests
This commit is contained in:
@@ -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 = '../..';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user