DEV Community

Amey Sunu
Amey Sunu

Posted on

Running Flutter Tests using Github Actions

My Workflow

My workflow is a testing parameter for Flutter Apps, and I made it for my Flutter package which allows seamless integration of wit.ai with Flutter. The workflow runs a flutter test, that checks if there is a valid response from the wit.ai server, whenever there is push or pull request to the master branch.

Submission Category:

Phone Friendly

Yaml File or Link to Code

GitHub logo ameysunu / flutter_witai

Integrating wit.ai with Flutter for structured response based on your query.

Flutter wit.ai Package

Codemagic build status

wit.ai is a natural language interface for statements into structured data. This package helps get a structured data from wit.ai console as per the trained utterance for Flutter. You can read a lot more about wit.ai and its documentation here.

Feel free to hit me up with PR for any issues and further improvements for this package.

Getting Started

Begin by importing the package into your dart file.

import 'package:flutter_witai/flutter_witai.dart'

Create an object wit from the package's WitManager option. WitManager has three parameters, namely params, utterance and headers.

Within utterance, add your utterance text for which the data has to be generated, and within headers add your Server Access Token which can be retrieved from wit.ai settings console. params is the GET parameter for accessing various HTTP APIs. Various parameters for the retrieval of HTTP API can be viewed below.

    final wit =

YAML File:

name: Flutter Test
on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-java@v2
        with:
          distribution: 'zulu'
          java-version: '11'
      - uses: subosito/flutter-action@v1
        with:
          flutter-version: '2.0.5'

      - name: Get all Flutter Packages
        run: flutter pub get

      - name: Run a multi-line script
        run: flutter test
Enter fullscreen mode Exit fullscreen mode

Additional Resources / Info

Shoutout to Flutter Actions for helping me with the workflow analysis.

Discussion (0)