패키지, 저장소 및 앱 카테고리 검색

패키지 상세v3.0.0

fast_flutter_driver_tool

데스크톱에서 빠르게 플러터 드라이버 테스트를 실행하기 위한 도구 세트입니다.

AndroidiOSmacOSWindowsLinux
30일 다운로드
124
좋아요
7
Pub 점수
140

패키지 설치

flutter pub add fast_flutter_driver_tool

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

데스크톱 플랫폼에서 Flutter Driver 테스트를 가속화하기 위해 설계된 도구 키트로, 안드로이드, iOS, macOS, Windows 및 리눅스에서 더 빠른 테스트 실행을 가능하게 합니다. 테스트 환경을 최적화하고 오버헤드를 줄여 통합 테스트의 설정과 실행을 간소화합니다. 개발 중 또는 CI/CD 파이프라인에서 효율적이고 반복 가능한 테스트 워크플로우를 원하는 개발자에게 이상적입니다. 이 도구는 테스트 환경을 시작하고 관리하는 데 일반적으로 발생하는 지연을 최소화하여 생산성을 향상시킵니다.

사용 사례

  • 로컬에서 통합 테스트 실행
  • CI/CD 테스트 주기 가속화
  • 여러 데스크톱 플랫폼에서 테스트
  • 빠른 UI 상호작용 디버깅
  • 엔드 투 엔드 테스트 세트 자동화

주요 기능

  • 최적화된 테스트 실행 속도
  • 다중 데스크톱 플랫폼 지원
  • 최소 설정 오버헤드
  • Flutter Driver와의 원활한 통합
  • 크로스 플랫폼 테스트 일관성

적합한 대상

  • 빠른 피드백 루프를 우선시하는 개발자
  • CI/CD에서 Flutter Driver를 사용하는 팀
  • 테스트 자동화 엔지니어
  • 데스크톱 중심의 Flutter 애플리케이션

고려 사항

  • Flutter Driver 설정이 필요합니다
  • 데스크톱 플랫폼에 한정
  • 복잡한 테스트 시나리오의 경우 추가 구성이 필요할 수 있습니다
  • 모바일 전용 테스트 실행을 위한 것이 아님

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Fast Flutter Driver

Build codecov

Plugin Pub
Command Line Tool pub package
UI Helper pub package

Deprecation Warning

Flutter Driver tests are being deprecated in favor of new Integration Tests. I will continue to support this package as long it's feasible but it is recommended to start using Integration Tests.

You can read more Pros and Cons here.

Toolkit for running rapidly flutter driver tests on desktop/mobile.

This package simplifies the creation of Flutter Driver tests that can be run in bulk without restarting or rebuilding the application. An example of how the toolkit works can be found in this article.

The reasoning for Desktop tests

The desktop builds are almost identical to Android/iOS builds in regard to the UI. Running tests on a simulator/emulator are painful. This can be even worse on your CI.

Your CI is usually a dockerized Linux machine - running Linux flutter driver tests against Linux Flutter application is both fast and reliable. This tool allows you to run your flutter driver tests much faster and more reliably than a build for a simulator/emulator.

The application flows that require Android/iOS plugins should still be run on a Simulator/Emulator or a real device.

Running also on Android/iOS

While running tests against Desktop will find the majority of bugs, it is recommended to run sometimes against actual devices. There are bugs in Dart (like implementing your generics in an invalid way) that can cause a native crash on a mobile device and work properly on the desktop.It's prudent to run fastdriver tests before every release on a mobile device.

Example

You can build and execute the example that works on any desktop system and Docker as well.

Usage

  • Add dev_dependency to your pubspec.yaml
dev_dependencies:
  fast_flutter_driver: ^2.0.0
  • Create configuration class test_driver/generic/test_configuration.dart
import 'package:fast_flutter_driver/tool.dart';
import 'package:meta/meta.dart';

class TestConfiguration implements BaseConfiguration {
  const TestConfiguration({
    required this.resolution,
    this.platform,
  });

  factory TestConfiguration.fromJson(Map<String, dynamic> json) {
    return TestConfiguration(
      resolution: Resolution.fromJson(json['resolution']),
      platform: TestPlatformEx.fromString(json['platform']),
    );
  }
  @override
  final TestPlatform? platform;
  @override
  final Resolution resolution;
  
  @override
  Map<String, dynamic> toJson() {
    final p = platform;
    return <String, dynamic>{
      'resolution': resolution,
      if (p != null) 'platform': p.asString(),
    };
  }
}

  • Create dart file test_driver/generic/generic.dart with content and MyApplication as your main (root) application widget.
import 'dart:convert';

import 'package:fast_flutter_driver/driver.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_driver/driver_extension.dart';

import 'test_configuration.dart';

void main() {
  timeDilation = 0.1;
  enableFlutterDriverExtension(
    handler: (playload) async {
      await configureTest(
        TestConfiguration.fromJson(json.decode(playload ?? '{}')),
      );
      return '';
    },
  );

  runApp(
    RestartWidget<TestConfiguration>(
      builder: (_, config) => MyApplication(),
    ),
  );
}

  • Create a test, eg test_driver/example_test.dart
import 'dart:convert';

import 'package:fast_flutter_driver/tool.dart';
import 'package:flutter_driver/flutter_driver.dart';
import 'package:test/test.dart';

import 'generic/test_configuration.dart';

void main(List<String> args) {
  late FlutterDriver driver;
  final properties = TestProperties(args);

  setUpAll(() async {
    driver = await FlutterDriver.connect(dartVmServiceUrl: properties.vmUrl);
  });

  tearDownAll(() async {
    await driver.close();
  });

  Future<void> restart() {
    return driver.requestData(
      json.encode(
        TestConfiguration(
          resolution: properties.resolution,
          platform: properties.platform,
        ),
      ),
    );
  }

  test('main application', () async {
    await restart();

    await driver.waitFor(find.byType('MyApplication'));
  });
}

pub global activate fast_flutter_driver_tool
  • Run:
fastdriver --dart-args "--no-sound-null-safety" --flutter-args "--no-sound-null-safety"

All done!

What's next

This was the simplest setup of tests, next you would like to pass different application configuration so every time you run tests, they could be run with a different configuration (eg different page). To do that you need to add more properties to TestConfiguration.

A full example of how to do that can be found in the example folder.

Null Safety

The package supports building project that are migrated to null safety but until flutter driver is migrated to null safety, we need to pass the above flags to the command line tool.

카테고리

의존성

의존성 목록 7 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.