Integration Testing

Integration testing (also called end-to-end testing or GUI testing) is used to simulate a user interacting

with your app by doing things like clicking buttons, selecting items, scrolling items, etc.
Integration testing is used to test how individual pieces work together as a whole, or capture the performance of an application running on a real device.

Plugin used

integration_test

 

Setup for Integration Test

img.1
  • We declared the integration_test package in pubspec.yaml as shown in the img.1

 

 

  • The test_driver directory, contains the

    integration_test_driver.dart file. (The folder structure is shown in img. 2). Inside this file, the integration driver is called.

 

  • The integration_test directory contains the test script files of different screens.

 

  • The Test Inputs directory contains the test_inputs.dart file. This file has the user actions inputs in json format. We can change user actions in this file.

 

Run the Integration Test

There are two ways to start the integration testing :

  • To run the integration test on virtual emulator / mobile , run the command on your terminal :
    cd ./frontend/mgramseva && flutter drive --driver=test_driver/integration_test_driver.dart
    --target=integration_test/login_test.dart

(---or---)

  • Go to ./frontend/mgramseva/utils/execute_integration.sh and run the execute_integration.sh file on the virtual emulator / mobile . The integration test will start.

 

Files Path

User actions Inputs - .frontend/mgramseva/integration_test/Test Inputs/test_inputs.dart

Integration Test Driver - .frontend/mgramseva/test_driver/integration_test_driver.dart

Execute Integration Test - .frontend/mgramseva/utils/execute_integration.sh

 

Reference Links

https://docs.flutter.dev/cookbook/testing/integration/introduction