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

패키지 상세v3.0.4

over_react_test

OverReact 컴포넌트 테스트를 위한 라이브러리

Web
30일 다운로드
9.7천
좋아요
1
Pub 점수
85

패키지 설치

flutter pub add over_react_test

패키지 개요

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

OverReact 컴포넌트 전용으로 설계된 테스트 라이브러리로, 플러터에서 리액트 유사 UI 컴포넌트에 대한 신뢰할 수 있는 단위 및 통합 테스트를 작성할 수 있게 해줍니다. 컴포넌트 렌더링, 사용자 상호작용 시뮬레이션, 출력 검증을 위한 유틸리티를 제공하여 컴포넌트의 동작이 기대와 일치함을 보장합니다. Workiva가 개발했으며, 플러터 테스팅 생태계와 원활하게 통합되며 웹 플랫폼에 최적화되어 있습니다. 이 라이브러리는 OverReact 애플리케이션 내에서 복잡한 컴포넌트 계층 구조와 상태 관리를 테스트하는 것을 간소화합니다.

사용 사례

  • OverReact 컴포넌트 렌더링 테스트
  • 클릭 및 입력과 같은 사용자 상호작용 시뮬레이션
  • 컴포넌트 상태 변경 검증
  • 웹 앱에서 DOM 출력 확인
  • UI 로직에 대한 단위 및 통합 테스트 작성

주요 기능

  • 컴포넌트 렌더링 유틸리티
  • 이벤트 시뮬레이션 도우미
  • DOM 검증 도구
  • 웹 플랫폼 최적화
  • Flutter 테스트 프레임워크와의 원활한 통합

적합한 대상

  • OverReact를 사용하는 Flutter 개발자
  • 복잡한 웹 UI를 구축하는 팀
  • 테스트 주도 개발 워크플로
  • 컴포넌트 신뢰성에 집중하는 프론트엔드 팀

고려 사항

  • 웹 플랫폼에만 제한됨
  • OverReact 종속성 필요
  • 복잡한 상태를 위해 추가 설정이 필요할 수 있습니다
  • 이미 OverReact를 사용 중인 프로젝트에 가장 적합

원본 README

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

OverReact Test

Pub Build Status Documentation

A library for testing OverReact components.

Using it in your project

  1. Import it into your test files:

    import 'package:over_react_test/over_react_test.dart';
    
  2. Run your tests:

    $ dart run test test/your_test_file.dart
    

Naming Conventions

Variables and Types
Usage Actual Type Suggested Referencing
render and render helper functions ReactComponent | Element instance
Component class ReactClass type
VDOM Instance (invoked UiProps) ReactElement -ReactElement or not suffixed
findDomNode, queryByTestId, etc. Element node
The Dart component react.Component (backed by ReactComponent) dartInstance
Invoked UiFactory UiProps builder

Example:

test('my test' () {
  var sampleBuilder = Sample();
  var sampleReactElement = sampleBuilder(); // Or var sample = sampleBuilder();
  var instance = render(sampleInstance);
  SampleComponent sampleDartInstance = getDartComponent(instance);
  var sampleNode = findDomNode(instance);
});
Test IDs

When coming up with test ID strings:

  • DO NOT use spaces; space-delimited strings will be treated as separate test IDs

    Just like CSS class names, you can use multiple test IDs together, and use any one of them to target a given component/node.

  • PREFER following our naming scheme for consistency across projects:

    <library>.<Component>[.<subpart>...].<part>

    We recommend including a library abbreviation and component name within a test ID so that it's easy to track down where that ID came from.

    Namespacing (.<subpart>) can be added however it makes sense.

    Finally, test IDs should be descriptive and useful in the context of tests.

    Examples:

    • wsd.DatepickerPrimitive.goToSelectedButton
    • sox.AbstractDataLayoutGroup.headerBlock.title
  • CONSIDER adding multiple IDs to serve different purposes

    for (var i = 0; i < items.length; i++) {
      // ...
        ..addTestId('foo.Bar.menuItem')
        ..addTestId('foo.Bar.menuItem.$i')
        ..addTestId('foo.Bar.menuItem.${items[i].id}')
      // ...
    }
    

    With the output of above code, you can:

    • target all of the Bar component's menu items using foo.Bar.menuItem
    • target the 4th item using foo.Bar.menuItem.3
    • target the item corresponding to an item with id baz123 using foo.Bar.menuItem.baz123

    This won't always be needed, but it comes in handy in certain cases.

Documentation

You would never skip reading the docs for a new language you are asked to learn, so please don't skip over reading our API documentation either.

Contributing

Yes please! (Please read our contributor guidelines first)

Versioning

The over_react_test library adheres to Semantic Versioning:

  • Any API changes that are not backwards compatible will bump the major version (and reset the minor / patch).
  • Any new functionality that is added in a backwards-compatible manner will bump the minor version (and reset the patch).
  • Any backwards-compatible bug fixes that are added will bump the patch version.

카테고리

의존성

의존성 목록 6 개

소스 저장소

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

아직 데이터가 없습니다.