Friday, May 13, 2022

The structure of autotests in Flutter-project Surf (part 2)

gherkin_suite_test.dart - File where flutter_gherkin is configured and tests run.


gherkin_suite_test.g.dart — File generated by build_runner based on scripts in feature files. Reason: integration_test currently requires all code to be generated before the tests run. The content should not be edited.


step_definitions_library.dart - The file is needed to combine lists of step implementations into one list, which will be passed to the stepDefinitions parameter of the config.


test_keys - Widgets component key files for identification.


main - The file that allows you to run the application.


test — Folder with Unit and Widget tests.


_screen.dart - Used to keep "locators" in one place and separate them by screens and features. And also for reuse between Widget and E2E tests: finders have the same syntax. Also in the screen file there may be parameters for the context or "gestures" that are used in steps with swipes.


_utils.dart - Files containing various outsourced methods for reuse in E2E test steps or Widget tests. Basically, extensions of the WidgetTester class. Such utils almost always require a WidgetTester instance, so instead of passing it as a parameter, you can write an extension. So it will be more clear and convenient.


screens_library.dart — File for grouping screens. Makes it easier to import in steps and Widget tests.


test_delays.dart - Different delays for requests and interactions.


pubspec.yaml - Contains the dependencies for the flutter project.


integration_test.dart - Most of the file is the code needed to properly generate the Cucumber-json report. The most important part is in the main function. It sets the path for the report and returns the driver for the tests.

The structure of autotests in Flutter-project Surf (part 1)

build.yaml - Contains the setting for build_runner. The main use is to add folders and files that the code generator can see.


dart_test.yaml - Contains configuration for Unit and Widget tests. For example, tags for filtering tests.


_profile.dart - Contains the correspondence of accounts in scripts to real accounts. Makes it easier to change accounts in scenarios, as well as have different profiles if needed.


credentials.dart - Contains data from profile accounts. You can specify different data - what is required for the scenario.


texts.dart - Contains various texts in the application. For example, error snack texts for future use in tests. If the application has several languages, a separate object is created for each.


.feature files - Contains Gherkin scripts. Each step of these scenarios is implemented and executed as part of the test.


gherkin_reports - Report.


_hook.dart - Hooks used by flutter_gherkin during script execution. There are different types, they are executed at the necessary moment of the application state.


_steps.dart - Files containing the implementation of the steps from the Gherkin script. Broken into different files by meaning. Together they are collected by step_definitions_library.dart. The file contains a step class with a list of steps definitions.


_world.dart - Objects that in the flutter_gherkin framework store the state of the current scenario. In _world.dart files we can add or override object logic. For example, to give the ability to pass information within the script between steps.

The structure of autotests in Flutter-project Surf (part 2)

gherkin_suite_test.dart - File where flutter_gherkin is configured and tests run. gherkin_suite_test.g.dart — File generated by build_runner...