Giter VIP home page Giter VIP logo

flutter's Introduction

Flutter Testing

*Note - Using Pubspec VS code Extension for adding different packages in flutter yaml File

In general we are two types of testing

  • Manual - Which in person tests every functionality and performance of an app
  • Automated - Here we instructs the software by a program which run in an automated way which like UnitTests Without a human prescence.

Flutter in which we can bulid websites or apps for different platforms using a single codebase.And With this we are having Testing in the same codebase which we can add all code for our testing

Flutter Comes under an automated testing platform Which It consists in three types.

  • Unit Testing
  • Widget Testing
  • Integration Testing

As per my learning i really preffer the following testing preferences - Unit Testing -> Integration Testing -> Widget Testing

Below Table Shows the Total Efficency and performance of each Testing Methods.

Unit Widget Integration
Confidence Low Higher Highest
Maintenance cost Low Higher Highest
Dependencies Few More Most
Execution speed Quick Quick Slow

Unit Testing

  • These are Useful for evaluating the behaviour of an single method, class or a function.
  • Here the test package provides the core framework for writing unit tests, and the flutter_test package provides additional utilities for testing widgets.

Firstly Initalizing the test packages in our flutter as follows -

  • Go Into pubspec.yaml file and add configuration as in dependencies.
dependencies:
  flutter:
    sdk: flutter
  provider: ^5.0.0            # new Testing provider package 
  • And also add test packages in dev_dependencies as follows
dev_dependencies:
  flutter_test:
    sdk: flutter
  integration_test:           # new for performing integration testing.
    sdk: flutter              # new
  test: ^1.14.4               # new for other packages for unit or widget testing.

Widget Testing

testWidgets('Add and remove a todo', (tester) async {
   // Testing Using Function name
  await tester.pumpWidget(const "FunctionName"());

  // Enter 'hi' into the TextField.
  await tester.enterText(find.byType(TextField), 'hi');
});

flutter's People

Contributors

srivathsav-max avatar srivathsav35 avatar

Watchers

 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.