2021/6/19 : Flutter : How to test a Flutter appの訳

 

Contents

About this codelab

Written by Abdullah Deshmukh, Brett Morgan


Flutter is Google’s UI toolkit for building beautiful, natively compiled applications for mobile, web, and desktop from a single codebase.

In this codelab, you’ll build and test a simple Flutter app. The app will use the Provider package for managing state.

Flutterは、単一のコードベースからモバイル、ウェブ、デスクトップ向けにネイティブにコンパイルされた美しいアプリケーションを構築するためのGoogleのUIツールキットです。

このコードラボでは、単純なFlutterアプリをビルドしてテストします。アプリは、状態を管理するためにProviderパッケージを使用します。

 

What you’ll learn

  • How to create widget tests using the widget testing framework
  • How to create an integration test to test the app’s UI and performance using the integration_test library
  • How to test data classes (providers) with the help of unit tests
  • ウィジェットテストフレームワークを使用してウィジェットテストを作成する方法
  • integration_testライブラリを使用してアプリのUIとパフォーマンスをテストする統合テストを作成する方法
  • 単体テストを使用してデータクラス(プロバイダー)をテストする方法

What you’ll build

In this codelab, you’ll start by building a simple application with a list of items. We provide the source code for you so you can get right to the testing. The app supports the following operations:

  • Adding the items to favorites
  • Viewing the list of favorites
  • Removing items from the favorites list

構築するもの

このコードラボでは、アイテムのリストを使用して単純なアプリケーションを構築することから始めます。テストにすぐに取り掛かることができるように、ソースコードを提供します。アプリは次の操作をサポートしています。

  • お気に入りにアイテムを追加する
  • お気に入りのリストを表示する
  • お気に入りリストからアイテムを削除する

Once the app is complete, you will write the following tests:

  • Unit tests to validate the add and remove operations
  • Widgets tests for the home and favorites pages
  • UI and performance tests for the entire app using integration tests

アプリが完成したら、次のテストを作成します。

  • 追加および削除操作を検証するための単体(Unit)テスト
  • ホームページとお気に入りページのウィジェット(Widgets)テスト
  • 統合(integration)テストを使用したアプリ全体のUIおよびパフォーマンステスト

2. Set up your Flutter environment

You need two pieces of software to complete this lab: the Flutter SDK, and an editor.

このラボを完了するには、FlutterSDKと エディターの2つのソフトウェアが必要 です。

 

You can run this codelab using any of the following devices:

  • A physical device (Android or iOS) connected to your computer and set to developer mode.
  • The iOS simulator. (Requires installing Xcode tools.)
  • The Android emulator. (Requires setup in Android Studio.)

このコードラボは、次のデバイスのいずれかを使用して実行できます。


 

 

 

 

参考

https://codelabs.developers.google.com/codelabs/flutter-app-testing/

コメントを残す

メールアドレスが公開されることはありません。