Unverified Commit 86120659 authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Update integration_test README for iOS (#71859)

parent 9a31c39a
...@@ -180,33 +180,40 @@ devices you want to test on. See ...@@ -180,33 +180,40 @@ devices you want to test on. See
## iOS Device Testing ## iOS Device Testing
You need to change `iOS/Podfile` to avoid test target statically linking to the plugins. One way is to Open `ios/Runner.xcworkspace` in Xcode. Create a test target if you
link all of the plugins dynamically: do not already have one via `File > New > Target...` and select `Unit Testing Bundle`.
Change the `Product Name` to `RunnerTests`. Make sure `Target to be Tested` is set to `Runner`.
Select `Finish`.
Add the new test target to `ios/Podfile` by embedding in the existing `Runner` target.
``` ```
target 'Runner' do target 'Runner' do
use_frameworks! # Do not change existing lines.
... ...
end
```
To run `integration_test/foo_test.dart` on your iOS device, rebuild your iOS
targets with Flutter tool.
```sh target 'RunnerTests' do
# Pass --simulator if building for the simulator. inherit! :search_paths
flutter build ios integration_test/foo_test.dart end
end
``` ```
Run `flutter build ios` from your project file to hook up the new settings.
Open Xcode project (by default, it's `ios/Runner.xcodeproj`). Create a test target In Xcode, add a test file called `RunnerTests.m` (or any name of your choice) to the new target and
(navigating `File > New > Target...` and set up the values) and a test file `RunnerTests.m` and replace the file:
change the code. You can change `RunnerTests.m` to the name of your choice.
```objective-c ```objective-c
#import <XCTest/XCTest.h> @import XCTest;
#import <integration_test/IntegrationTestIosTest.h> @import integration_test;
INTEGRATION_TEST_IOS_RUNNER(RunnerTests) INTEGRATION_TEST_IOS_RUNNER(RunnerTests)
``` ```
Now you can start RunnerTests to kick-off integration tests! Run `Product > Tests` to run the integration tests on your selected device.
To build `integration_test/foo_test.dart` from the command line, run:
```sh
# Pass --simulator if building for the simulator.
flutter build ios integration_test/foo_test.dart
```
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment