This document describes the testing infrastructure for the iOS flavor configuration scripts.
The project includes comprehensive testing for iOS flavor configuration to ensure proper setup before attempting to build or run the application with flavors.
Purpose: Validates the complete iOS flavor configuration
What it tests:
- ✓ Xcode project file exists
- ✓ Schemes directory exists
- ✓ All flavor schemes exist (development, staging, production)
- ✓ Runner scheme exists
- ✓ All schemes are valid XML
- ✓ Standard build configurations (Debug, Release, Profile)
- ✓ Flavor-specific build configurations
- Debug-development, Debug-staging, Debug-production
- Release-development, Release-staging, Release-production
- Profile-development, Profile-staging, Profile-production
- ✓ Scheme content has proper BuildableReference
Usage:
# Run directly
./scripts/test_ios_config.sh
# Or via Make
make ios-testOutput:
- Shows pass/fail status for each test
- Provides detailed instructions if tests fail
- Returns exit code 0 on success, 1 on failure
Exit Codes:
0: All tests passed, iOS flavors properly configured1: Some tests failed, configuration needed
Purpose: Validates the test scripts themselves
What it tests:
- ✓ Test scripts exist
- ✓ Scripts are executable
- ✓ Scripts have proper shebangs
- ✓ Required paths are defined
- ✓ All flavor schemes are checked
- ✓ XML validation is performed
- ✓ Build configurations are checked
- ✓ Scripts use colored output
- ✓ Exit codes are properly set
- ✓ Helpful instructions are provided
Usage:
# Run directly
./scripts/test_scripts_unit.sh
# Or via Make
make test-scriptsOutput:
- Tests the internal structure of test scripts
- Validates script behavior and completeness
- Returns exit code 0 on success, 1 on failure
Purpose: Guides users through iOS flavor setup
What it does:
- Runs
test_ios_config.shto check current state - Provides success message if already configured
- Shows detailed instructions if configuration needed
- Links to README documentation
Usage:
# Run directly
./scripts/configure_ios_flavors.sh
# Or via Make
make ios-setup-
Initial Setup:
make setup
-
Check iOS Configuration:
make ios-setup
-
If Tests Fail:
- Follow the instructions printed by the script
- Open Xcode:
open ios/Runner.xcworkspace - Configure build configurations as instructed
- Re-run:
make ios-test
-
If Tests Pass:
make run-dev # or run-stg, run-prod
# In your CI pipeline
make test-scripts # Validate test scripts
make ios-test # Check iOS configuration✅ All tests passed!
Meaning: iOS flavors are properly configured. You can proceed with:
make run-devmake run-stgmake run-prod
Testing: Development scheme exists... ✓ PASS
Testing: Staging scheme exists... ✓ PASS
...
Debug-development... ⚠ Missing
Meaning: Schemes exist (good) but build configurations are missing in Xcode project.
Action Required: Configure build configurations in Xcode (see instructions below)
Testing: Xcode project file exists... ✗ FAIL
Meaning: Project structure issue
Action Required: Check project integrity or repository state
If make ios-test shows missing build configurations:
-
Open Xcode:
open ios/Runner.xcworkspace
-
Select Runner PROJECT:
- Click "Runner" in the left navigator
- Make sure the PROJECT (blue icon) is selected, not the target
-
Navigate to Configurations:
- Click the "Info" tab
- Expand the "Configurations" section
-
Duplicate Configurations:
For Debug configurations:
- Click "+" under Configurations
- Select "Duplicate Debug Configuration"
- Rename to:
Debug-development - Repeat for:
Debug-staging,Debug-production
For Release configurations:
- Duplicate Release Configuration three times
- Name:
Release-development,Release-staging,Release-production
For Profile configurations:
- Duplicate Profile Configuration three times
- Name:
Profile-development,Profile-staging,Profile-production
-
Verify:
make ios-test
Solution: xmllint is included with macOS. If missing:
# Update Xcode Command Line Tools
xcode-select --installSolution:
- Clean build artifacts:
make clean - Run setup again:
make setup - Verify with:
make ios-test - Try:
flutter run --flavor production -t lib/flavors/main_production.dart
Problem: Target selected instead of project
Solution:
- Click away from the target
- Select the Runner PROJECT (blue icon at top of navigator)
- Try again
If you prefer not to configure Xcode, you can run without the --flavor flag:
flutter run -t lib/flavors/main_development.dart
flutter run -t lib/flavors/main_staging.dart
flutter run -t lib/flavors/main_production.dartThis works on iOS without requiring build configuration changes.
When modifying test scripts:
- Run unit tests:
make test-scripts - Run integration tests:
make ios-test - Ensure both pass before committing
- Update this documentation if behavior changes
| Component | Test Type | Coverage |
|---|---|---|
| Scheme Files | Integration | ✓ Existence, XML validity |
| Build Configs | Integration | ✓ All 9 flavor configs |
| Project File | Integration | ✓ Existence, structure |
| Test Scripts | Unit | ✓ 15 validation checks |
| Helper Scripts | Unit | ✓ Integration with tests |
- Automated Xcode project modification
- Android flavor configuration tests
- Continuous integration examples
- Visual test result reporting
- Pre-commit hooks for validation