TestController class

Controller that allows for the creation, loading, saving, and running of automated tests.

Constructors

TestController({Map<String, PageRoute> customRoutes, TestStepDelays delays: const TestStepDelays(), GoldenImageWriter goldenImageWriter: TestStore.goldenImageWriter, int maxCommonSearchDepth: 3, @required GlobalKey<NavigatorState> navigatorKey, @required AsyncCallback onReset, bool screenshotOnFail: false, String selectedSuiteName, bool stopOnFirstFail: false, TestStepRegistry registry, TestImageReader testImageReader: TestStore.testImageReader, TestReader testReader: TestStore.testReader, WidgetBuilder testReportBuilder, Level testReportLogLevel: Level.INFO, TestReporter testReporter: TestStore.testReporter, WidgetBuilder testSuiteReportBuilder, TestWriter testWriter: TestStore.testWriter, Map<String, dynamic> variables})
A controller for a TestRunner that can create, run, load, and save automated tests. [...]

Properties

currentTest Test
Returns the current from the controller. This will never be null.
read / write
customRoutes Map<String, PageRoute>
Returns the custom routes, sorted by the display name.
read-only
delays TestStepDelays
The delays that tests should wait for.
final
goldenImageWriter GoldenImageWriter
Writer that saves golden images for a particular device.
final
hashCode int
The hash code for this object. [...]
read-only, inherited
maxCommonSearchDepth int
Defines how far down a widget tree a Testable widget should look for a supported widget for the purposes of getting or setting values and errors.
final
onReset AsyncCallback
Callback function that the application must register with the controller so that when a reset is requested by a test, the application properly resets to the initial state.
final
registry TestStepRegistry
Returns the registry that is being used by the controller.
read-only
runningTest bool
Returns whether or not the controller is actively running a test now or not.
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
screencapStream Stream<CaptureContext>
Returns the stream that will fire screep capture requests on.
read-only
screenshotOnFail bool
Defines whether the framework should take a screenshot automatically whenever a failure is detected or not.
final
selectedSuiteName String
The currently selected test suite name.
read / write
sleep ProgressValue
Informs the controller that a sleep status update has happened.
write-only
sleepStream Stream<ProgressValue>
Returns the stream that will fire updates as a test is sleeping / waiting.
read-only
status String
Informs the controller that a test status update has happened.
write-only
statusStream Stream<String>
Returns the stream that will fire updates when a test status changes.
read-only
step ProgressValue
Informs the controller that a test step update has happened.
write-only
stepStream Stream<ProgressValue>
Returns the stream that will fire updates when a test moves from step to step.
read-only
stopOnFirstFail bool
Defines whether or not the framework should stop on the first failed step or keep going and executing subsequent steps.
final
testImageReader TestImageReader
The image reader to read images for golden image comparisons.
final
variables Map<String, dynamic>
Returns an unmodifiable map of all the currently set variables.
read-only

Methods

clearCustomRoutes() → void
Clears all the custom routes.
clearVariables() → void
Clears all the variables.
dispose() → void
Disposes the controller.
execute({String name, bool reset: true, List<TestStep> steps, bool submitReport: true, String suiteName, TestReport report, TestSuiteReport testSuiteReport, int version}) Future<TestReport>
Executes a series of tests steps. This accepts the name of the test which may be null or empty. The reset defines if the controller should ask the application to perform a full reset before running or if it should attempt to run for the current state. [...]
executeStep({TestReport report, TestStep step, bool subStep: true}) Future<bool>
Executes a single step and attaches the execution information to the testReport.
executeTest({Test test, TestReport report}) Future<TestReport>
Executes a single test. This will reset the application and submit the report. If the report is set it will be used, otherwise a net-new TestReport will be created and returned.
exportCurrentTest({bool clear: true, BuildContext context}) Future<bool>
Attempts to export the current test via the testWriter value. This will return true if and only if the current testWriter both returns true and no exceptions were thrown along the way. [...]
getVariable(String variableName) → dynamic
Returns the variable from the controller. This will return null if the variable is not currently set on the controller.
loadTests(BuildContext context, {String suiteName}) Future<List<PendingTest>>
Loads the list of tests from the assigned TestReader. This accepts the BuildContext to allow the reader to provide visual feedback to the user in case the load takes a while.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
registerCustomRoute(String display, PageRoute route) → void
Registers a custom route with the framework. These routes will be displayed on the TestStepsDialog and TestStepsPage. The display is the string to display in a ListTile's title to trigger navigation to the route. If the route is null, this will remove any route registered to the display. If the display is already registered, it will be replaced with the new route
removeVariable({String variableName}) → void
Removes the variable with the given variableName from the controller.
reset() Future<void>
Requests the application to perform a reset.
resolveVariable(dynamic input) → dynamic
Resolves the given input with any potential variable on the controller. Variable values use the mustache format and must begin with {{ and end with }}. If the input is not marked as a variable or there is no variable with the matching key registered then the input will be return unaltered.
runPendingTests(List<PendingTest> tests) Future<TestSuiteReport>
Runs a series of tests. For full runs, this is more memory efficient as it will only load the tests as needed.
runTests(List<Test> tests) Future<TestSuiteReport>
Runs a series of tests. This is useful for smaller numbers of in-memory tests but the runPendingTests should be prefered for full application runs or for CI/CD pipelines as that only loads the bare minimum data up front and then loads the full test data on an as needed basis.
screencap() Future<Uint8List>
Executes a screen capture for the application. As a note, depending on the device this may take several seconds. The screenshot call is fully async so this will wait until up to TestStepDelays.screenshot for the response. [...]
setVariable({dynamic value, String variableName}) → void
Sets the variable with the variableName to the value.
submitReport(TestReport report) Future<bool>
Submits the test report through the TestReporter.
toString() String
Returns a string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited

Static Methods

of(BuildContext context) TestController
Returns the TestController provided by the widget tree. This will never throw an exception but may return null if no controller is available on the widget tree.