简体   繁体   中英

Codemagic: how do I set up integration tests Android Emulator

Here is how the default configuration for tests looks like:

在此处输入图像描述

In Flutter Drive arguments we can see that there is a target defined

drive --target=test_driver/main.dart

Flutter documentation on integration tests doesn't mention creating this file. So this folder with the respective file is missing in my project, which logically results into fail:

Target file "test_driver/main.dart" not found.

Here are the logs:

> flutter devices
3 connected devices:

Android SDK built for x86 (mobile) • emulator-5554 • android-x86    • Android 10 (API 29) (emulator)
macOS (desktop)                    • macos         • darwin-x64     • macOS 12.4 21F79 darwin-x64
Chrome (web)                       • chrome        • web-javascript • Google Chrome 103.0.5060.114
> flutter -d emulator-5554 drive --target=test_driver/main.dart
Target file "test_driver/main.dart" not found.

The documentation on how to write integration tests only mentions test_driver when testing web.

Apparently I am either missing stuff in my project or I need to configure codemagic workflow differently.

There is a bit information here https://docs.codemagic.io/yaml-testing/testing/ for yaml configuration. Should i switch to yaml config, or can it be done from CodeMagic UI?

UPDATE: After I have change the configuration as mentioned in the answers to this:

在此处输入图像描述

The logs are now:

Test file not found: > /Users/builder/clone/test_driver/app_test_test.dart

The recommended approach per Flutter documentation is to use:

flutter test integration_test

Thus, in the arguments section in Codemagic, just add test integration_test .

test_driver/main.dart is just a placeholder. Flutter documentation covered this in step 3. Create the test files

And in Codemagic you need to specify drive --target=integration_test/app_test.dart

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM