Coder Social home page Coder Social logo

donniezhanggit / flutter_bdd Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jerseysu/flutter_bdd

0.0 0.0 0.0 11.93 MB

Sample Project for Flutter + flutter_gherkin demo

Home Page: https://medium.com/@loverjersey/%E7%8E%A9%E4%B8%80%E7%8E%A9-flutter-gherkin-gherkin-with-flutter-b84e246f50a2

Java 2.56% Objective-C 6.22% Dart 78.69% Gherkin 4.61% HTML 2.20% JavaScript 3.24% Ruby 2.48%

flutter_bdd's Introduction

flutter_bdd

Sample Project for Flutter + flutter_gherkin demo

The sample project is based on following instruction:

Requirements

flutter_gherkin Installation:

Setup flutter_gherkin into pubspec.yaml dependencies:

dependencies:
    flutter_gherkin: ^1.0.0

Adding a package dependency to an app:

# Install
$ flutter pub get

Execution Test:

Execute target to iOS / Android:

  • Use flutter devices to get target device id
# run flutter devices
$ flutter devices
Ex: (Android), default empty string
..targetDeviceId = "emulator-5554"
  • Execute command line with target devices
# execute command line
$ dart test_driver/app_test.dart

or 

$ flutter drive --target=test_driver/app.dart

Useful Sample:

  • Page Object Patterns
class LandingPage extends BasePage {

  final landingPageTitle = 'firstTabTitle';

  LandingPage(FlutterDriver driver) : super(driver) {
    final locator = super.finElementByKey(landingPageTitle);
    BasePage.waitFor(driver, locator);
  }

  Future<void> doSomething(FlutterWorld world) async {
    // doSomehting

  }
}
  • Step Definition
import '../pages/landing_page.dart';

class TapButtonNTimesStep extends When2WithWorld<String, int, FlutterWorld> {
  TapButtonNTimesStep()
      : super(StepDefinitionConfiguration()..timeout = Duration(seconds: 30));

  @override
  Future<void> executeStep(String key, int times) async {
    final landingPage = new LandingPage(world.driver);
    await landingPage.tapPlusOneBtnForNTimes(key, times, world);
  }

  @override
  RegExp get pattern => RegExp(r"I tap the {string} button {int} times");
}

  • Test Report
  1. Install npm package cucumber-html-reporter
# Install cucumber-html-reporter
$ npm install cucumber-html-reporter
  1. Display Report
# Go to report folder
$ cd report

# Display Report
$ node index.js

Documentation:

Blog: - Gherkin with Flutter

Author

Jersey Su โ€“ @jerseysu

flutter_bdd's People

Contributors

jerseysu 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.