Performs any test in a Flutter project.
Description
If you have tests in your repository, and selected yes when prompted during app creation, the primary Workflow will include the Flutter Test Step by default.
If you add tests to your app later, add the Flutter Test Step to your Workflow manually. The Step runs the flutter test command with the specified flags. To check the available flags, open a command line interface on your own machine and run flutter test --help.
- Provide your project's root directory in the Project Location field.
- The Step's test result directory is the root directory for all test results created by the Bitrise CLI. This input gets filled out automatically.
- You can append additional flags to the default
flutter testcommand in the Additional parameters field. - Select 'yes' in the Generate code coverage files input to get detailed analysis of your code.
On Flutter 3.10 and newer the Step prints the normal, human-readable flutter test output to the build log, and you can control its verbosity with a --reporter flag (for example --reporter expanded) in the Additional parameters field. On older Flutter versions the log falls back to the raw machine JSON stream. The machine-readable JSON needed for the JUnit test report and the BITRISE_FLUTTER_TESTRESULT_PATH output is collected separately, so it does not affect what you see in the log. Do not pass --file-reporter in Additional parameters — the Step manages it internally.
Make sure the Project Location input of the Flutter Test Step is correct. The default value is the Environment Variable (Env Var) created for your Flutter project’s location.
Add this step directly to your workflow in the Bitrise Workflow Editor.
You can also run this step directly with Bitrise CLI.
Inputs
| Key | Description | Flags | Default |
|---|---|---|---|
project_location |
The root dir of your Flutter project. | required | $BITRISE_SOURCE_DIR |
bitrise_test_result_dir |
Root directory for all test results created by the Bitrise CLI | required | $BITRISE_TEST_RESULT_DIR |
generate_code_coverage_files |
In case of generate_code_coverage_files: "yes" flutter test gets --coverage passed |
required | no |
additional_params |
The flags from this input field are appended to the flutter test command. For example, pass --reporter expanded to get more detailed, human-readable test output in the build log (Flutter 3.10+). Do not pass --file-reporter; the Step sets it up internally. |
||
tests_path_pattern |
The pattern from this input field is expanded and fed to the flutter test command. Both * and ** glob patterns are supported. For example, lib/**/*_test.dart. |
Outputs
| Environment Variable | Description |
|---|---|
BITRISE_FLUTTER_COVERAGE_PATH |
The path of the generated code coverage lcov.info file. |
BITRISE_FLUTTER_TESTRESULT_PATH |
The path of the json file that was generated by the flutter test command. |
We welcome pull requests and issues against this repository.
For pull requests, work on your changes in a forked repository and use the Bitrise CLI to run step tests locally.
Learn more about developing steps: