Skip to content

Add more tests to plugin template #82458

@stuartmorgan-g

Description

@stuartmorgan-g

Currently when making a plugin via flutter create -t plugin the tests it makes are:

  1. Dart unit tests for the plugin (test/)
  2. Dart unit tests for the example app (example/test/)

1 is useful (2 not so much), but woefully inadequate for a plugin because Dart unit tests can't load plugins, thus don't exercise any of the native code.

Based on what we've found to be best practice with our own plugins, we should add:

  • integration_test-based Flutter driver tests in example/ (this is probably the single most important category of tests for a plugin)
  • native unit tests for each native language
    • Android Java
    • Android Kotlin
    • iOS Obj-C
    • iOS Swift
    • Linux (C)
    • macOS (Swift)
    • Windows (C++)

This would make it clearer for people both what tests they should probably have, and also how to get started with them.

Metadata

Metadata

Labels

P1High-priority issues at the top of the work lista: pluginsSupport for writing, building, and running plugin packagespackageflutter/packages repository. See also p: labels.toolAffects the "flutter" command-line tool. See also t: labels.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions