FlutterDriverTestConfiguration class
Constructors
-
FlutterDriverTestConfiguration({String? featurePath = 'features/*.*.feature', Iterable<Pattern>? features, String featureDefaultLanguage = 'en', ExecutionOrder order = ExecutionOrder.random, Duration defaultTimeout = const Duration(seconds: 10), FeatureFileMatcher featureFileMatcher = const IoFeatureFileAccessor(), FeatureFileReader featureFileReader = const IoFeatureFileAccessor(), bool stopAfterTestFailed = false, String? tagExpression, Iterable<Hook>? hooks, Iterable<Reporter> reporters = const [], CreateWorld? createWorld, bool waitImplicitlyAfterAction = true, Iterable<CustomParameter>? customStepParameterDefinitions, Iterable<StepDefinitionGeneric<World>>? stepDefinitions, String targetAppPath = 'test_driver/app.dart', String? targetAppWorkingDirectory, String? buildFlavour, String? targetDeviceId, String? runningAppProtocolEndpointUri, Future<void> onBeforeFlutterDriverConnect()?, Future<void> onAfterFlutterDriverConnect(FlutterDriver driver)?, bool restartAppBetweenScenarios = true, bool logFlutterProcessOutput = false, bool keepAppRunningAfterTests = false, bool verboseFlutterProcessLogs = false, bool build = true, BuildMode buildMode = BuildMode.debug, Duration flutterBuildTimeout = const Duration(seconds: 90), Duration flutterDriverReconnectionDelay = const Duration(seconds: 2), int flutterDriverMaxConnectionAttempts = 3})
-
Properties
-
build
→ bool
-
If the application should be built prior to running the tests
Defaults to true
final
-
buildFlavour
→ String?
-
The build flavour to run the tests against (optional)
Defaults to null
final
-
buildMode
→ BuildMode
-
The default build mode used for running tests is --debug.
We are exposing the option to run the tests also in --profile mode
final
-
createWorld
→ CreateWorld?
-
An optional function to create a world object for each scenario.
finalinherited
-
customStepParameterDefinitions
→ Iterable<CustomParameter>?
-
Any user defined step parameters
finalinherited
-
defaultTimeout
→ Duration
-
The default step timeout - this can be override when definition a step definition
finalinherited
-
featureDefaultLanguage
→ String
-
The default feature language
finalinherited
-
featureFileMatcher
→ FeatureFileMatcher
-
finalinherited
-
featureFileReader
→ FeatureFileReader
-
finalinherited
-
features
→ Iterable<Pattern>
-
The path(s) to all the features.
All three
Pattern
s are supported: RegExp, String, Glob
.
finalinherited
-
flutterBuildTimeout
→ Duration
-
Duration to wait for Flutter to build and start the app on the target device
Slower machine may take longer to build and run a large app
Defaults to 90 seconds
final
-
flutterDriverMaxConnectionAttempts
→ int
-
The maximum times the flutter driver can try and connect to the running app
Defaults to 3
final
-
flutterDriverReconnectionDelay
→ Duration
-
Duration to wait before reconnecting the Flutter driver to the app.
On slower machines the app might not be in a state where the driver can successfully connect immediately
Defaults to 2 seconds
final
-
getAttachmentManager
→ CreateAttachmentManager
-
used to get a new instance of an attachment manager class that is passed to the World context
no setterinherited
-
hashCode
→ int
-
The hash code for this object.
no setterinherited
-
hooks
→ Iterable<Hook>?
-
Hooks that are run at certain points in the execution cycle
finalinherited
-
keepAppRunningAfterTests
→ bool
-
Will keep the Flutter application running when done testing
Defaults to false
final
-
logFlutterProcessOutput
→ bool
-
Logs Flutter process output to stdout
The Flutter process is use to start and driver the app under test.
The output may contain build and run information
Defaults to false
final
-
onAfterFlutterDriverConnect
→ (Future<void> Function(FlutterDriver driver)?)
-
Called after the successful connection of Flutter driver to the running application. Depending on your configuration this
method will be called on each new connection usually before each scenario is run.
final
-
onBeforeFlutterDriverConnect
→ (Future<void> Function()?)
-
Called before any attempt to connect Flutter driver to the running application, Depending on your configuration this
method will be called before each scenario is run.
final
-
order
→ ExecutionOrder
-
The execution order of features - this default to random to avoid any inter-test dependencies
finalinherited
-
reporters
→ Iterable<Reporter>
-
a list of reporters to use.
Built-in reporters:
finalinherited
-
restartAppBetweenScenarios
→ bool
-
restarts the application under test between each scenario.
Defaults to true to avoid the application being in an invalid state
before each test
final
-
retryDelay
→ Duration
-
When a step fails, it will wait this long before retrying.
For instance, you know that when it fails, it can take a bit longer (async).
finalinherited
-
runningAppProtocolEndpointUri
→ String?
-
An observatory url that the test runner can connect to instead of creating a new running instance of the target application
Url takes the form of
http://127.0.0.1:51540/EM72VtRsUV0=/
and usually printed to stdout in the form Connecting to service protocol: http://127.0.0.1:51540/EM72VtRsUV0=/
You will have to add the --verbose
flag to the command to start your flutter app to see this output and ensure enableFlutterDriverExtension()
is called by the running app
final
-
runtimeType
→ Type
-
A representation of the runtime type of the object.
no setterinherited
-
semanticsEnabled
→ bool
-
Enable semantics in a test by creating a SemanticsHandle.
See: testWidgets and WidgetController.ensureSemantics.
finalinherited
-
stepDefinitions
→ Iterable<StepDefinitionGeneric<World>>?
-
The user defined step definitions that are matched with written steps in the features
finalinherited
-
stepMaxRetries
→ int
-
When a step fails, it will retry this number of times.
When it still fails after these tries the step will fail.
finalinherited
-
stopAfterTestFailed
→ bool
-
the program will stop after any test failed
finalinherited
-
tagExpression
→ String?
-
a filter to limit the features that are run based on tags
see https://docs.cucumber.io/cucumber/tag-expressions/ for expression syntax
finalinherited
-
targetAppPath
→ String
-
The target app to run the tests against
Defaults to "test_driver/app.dart"
final
-
targetAppWorkingDirectory
→ String?
-
Option to define the working directory for the process that runs the app under test (optional)
Handy if your app is separated from your tests as flutter needs to be able to find a pubspec file
final
-
targetDeviceId
→ String?
-
The target device id to run the tests against when multiple devices detected
Defaults to null
final
-
verboseFlutterProcessLogs
→ bool
-
Sets the --verbose flag on the flutter process
Defaults to false
final
-
waitImplicitlyAfterAction
→ bool
-
Set to
True
to wait implicit for pumpAndSettle() / waitForAppToSettle() functions after performing actions
Defaults to false
finalinherited
Static Methods
-
standard(Iterable<StepDefinitionGeneric<World>> steps, {String featurePath = 'features/*.*.feature', String targetAppPath = 'test_driver/app.dart', String? targetAppWorkingDirectory, bool restartAppBetweenScenarios = true})
→ FlutterDriverTestConfiguration
-
Provide a configuration object with default settings such as the reports and feature file location
override