Giter Club home page Giter Club logo

flutter_gherkin_wrapper's Introduction

Flutter Gherkin Wrapper

Test Status Build Status

Wrapper is used to execute tests with Cucumber / Gherkin notation:

  • Support of widget and integration tests from a single code base
  • Nested scenarious
  • Emulation of Set Up / Tear Down with Cucumber / Gherkin notation

Getting started

Initialization

// Generate steps from resources
// ./test/e2e/given/generic.dart
@GenerateGherkinResources(['../steps'])
class Generics extends GivenGeneric {
  @override
  RegExp get pattern => RegExp('%step%');

  @override
  // Execute sub-step
  Future<void> executeStep() async {
    final reporter = FileReporter();
    final step = await FileReader().getFromString('''%feature%''', reporter);
    final result = await FileRunner(FileRunner.tester, reporter).run(step);
    if (!result) {
      reporter.publish();
    }
    expectSync(result, true);
  }
}


// Generate list of steps
// ./test/e2e/steps_iterator.dart
@GenerateListOfClasses(['given', 'when', 'then'])
import 'steps_iterator.list.dart';

ExecutableStepIterator.inject(classList);
# /test/e2e/steps/open_expense_form.resource.feature
Feature: Verify Basic Actions

  Scenario: Opened Expense Form
    Given I am on "Home" page
     When I tap "Add Bill, Income or Transfer" button
     Then I can see "Add new Bill" button

Execution

void main() {
  Iterable<File> features = Directory('./test/e2e')
      .listSync(recursive: true)
      .where(
          (entity) => entity is File && entity.path.endsWith('.test.feature'))
      .cast<File>();

  setUpAll(() {
    TestWidgetsFlutterBinding.ensureInitialized();
    ScreenCapture.enableScreenCapture();
    // MainTest.cleanUpData();
  });

  group('Run All End-To-End Tests', () {
    for (var file in features) {
      testWidgets(file.path, (WidgetTester tester) async {
        // await MainTest.init(tester);
        final runner = FileRunner(tester);
        await runner.init(file);
        // ! to avoid collisions in concurrent requests
        expectSync(await runner.run(), true);
        await tester.pumpAndSettle();
      }, timeout: const Timeout(Duration(minutes: 5)));
    }
  });
}
# /test/e2e/bill/create_different_expenses.test.feature
Feature: Verify Expenses Functionality

  Scenario Outline: Added different Expenses
    Given Opened Expense Form
     When I select "<account>" from "AccountSelector" with "Enter Account Identifier" tooltip
      And ...

In addition to thanking, you may treat us to โ˜•.

flutter_gherkin_wrapper's People

Contributors

lyskouski avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.