Run the unit tests for the Bugsnag library from Xcode or by running make test on the command-line. To specify a specific iOS SDK, run with the SDK name:
make SDK=iphonesimulator11.3 test
Or test on macOS:
make PLATFORM=macOS test
Or to test on tvOS:
make PLATFORM=tvOS test
These tests are implemented with our notifier testing tool Maze runner.
End to end tests are written in cucumber-style .feature files, and need Ruby-backed "steps" in order to know what to
run. The tests are located in the 'features' directory.
For testing against a real device, maze-runner's CLI and the test fixtures are containerized so you'll need Docker (and Docker Compose) to run them.
- Xcode
- Make
- BrowserStack credentials or device running a modern version of iOS.
Build the test iOS fixture:
make test-fixtures- Ensure the following environment variables are set:
MAZE_DEVICE_FARM_USERNAME- your BrowserStack App Automate UsernameMAZE_DEVICE_FARM_ACCESS_KEY- your BrowserStack App Automate Access KeyMAZE_BS_LOCAL- location of theBrowserStackLocalexecutable on your local file system
- See https://www.browserstack.com/local-testing/app-automate for details of the required local testing binary.
- Check the contents of
Gemfileto select the version ofmaze-runnerto use - To run a single feature:
bundle exec maze-runner --app=features/fixtures/ios/output/iOSTestApp.ipa \ --farm=bs \ --device=IOS_14 \ features/app_and_device_attributes.feature - To run all features, omit the final argument.
- Install a proxy server such as
mitmproxy:brew install mitmproxy
- Install Appium
npm install -g appium@1.21 - Set
MAZE_APPLE_TEAM_IDto your Apple Developer Team Id. - The test fixture is hard-coded to send requests to
bs-local.com:9339(BrowserStack's approach to local testing).
Add an entry for bs-local.com to/etc/hosts:127.0.0.1 bs-local.com - Install and run a proxy, such as
mitmproxymitmproxy
- Set a manual proxy on your device's network connection to the IP of your Mac and port of the proxy
(8080 by default for
mitmproxy).
- Run Maze Runner as follows, adjusting for your specific device:
bundle exec maze-runner --farm=local \ --app=features/fixtures/ios/output/iOSTestApp.ipa \ --udid=<udid> \ --os=ios \ features/app_and_device_attributes.feature
<udid>is the device Identifier found under Devices and Simulators in Xcode.
- Use
make e2e_macosto run tests and use theFEATURESenvironment variable to specify which tests to run:make e2e_macos FEATURES='features/barebone_tests.feature features/telemetry.feature'
- To create a code coverage report, set
ENABLE_CODE_COVERAGE=YESlike so:Openmake e2e_macos ENABLE_CODE_COVERAGE=YES
coverage/index.htmlto view the coverage report.
-
The
xcdebugcommand line tool - included in Xcode 13.4 and later. -
An Apple Watch paired to an iPhone that is connected via USB and visible in Xcode's devices window.
-
The Apple Watch must be on the same WiFi network as the computer executing Maze runner.
Due to device and tooling constraints, not all tests are suitable for running on Apple Watch.
Tests that support Apple Watch are tagged with @watchos.
-
To run all supported tests:
make e2e_watchos
-
To run an individual test:
make e2e_watchos FEATURES=features/breadcrumbs.feature:59
E2E testing for Apple Watch relies on the xcdebug to build and run the test fixture.
xcdebug triggers actions in the Xcode IDE, but does not provide feedback about the success of those actions, so Maze runner will not be able to detect failures.
Pay attention to Xcode's UI to see if there are any build or run failures.
Ensure Xcode's run destination is set to the Apple Watch.
- Maze Runner supports various other options, as well as all those that Cucumber does. For full details run:
bundle exec maze-runner --help