Preparing the servers your app depends on
Put the servers, DBs and stubs your own app (for example the test project myshop) uses into containers and declare them to fleetest. This is not needed if you only connect to an existing server. How to read the declaration and how to start it are in the tutorial with the sample app.
1. Declare the servers and check them
Prompt for the AI
Build the image myapp-server:local from the Dockerfile in <server folder> and declare it in
TestProjects/myshop/workspace/scripts/compose.yaml of the fleetest test project myshop. If there is no Dockerfile, create one
(split a build stage from a run stage, and include a command the healthcheck uses to read /health (curl or wget) in the run stage). Publish the port on 127.0.0.1:8080. Write a healthcheck.
If you use Apple Container, first enlarge the builder VM with `container builder stop && container builder start --cpus 6 --memory 8g`.
Make the app's server address switchable in the build settings: http://127.0.0.1:8080 for the iOS Simulator build and http://10.0.2.2:8080 for the Android Emulator build.
Rebuild both and update the paths in the app profile.
Check the start-up with fleetest services up --project myshop, confirm that /health returns ok, then services down and report the result.
Expected result:
services upprints the published ports, and/healthreturns ok.- After
services down,services statusshowsleases: noneand lists no containers (named volumes and images remain;services resetremoves them).
2. Point the app at the server
The iOS Simulator build points at 127.0.0.1 and the Android Emulator build at 10.0.2.2 (the prompt above includes this). Physical devices differ by OS.
- iOS physical device: build with this Mac's LAN address baked in (the machine setting
services.publishForPhysicalDevicesis also needed; a worked example is in steps 2-3 of Measuring the app's responsiveness). - Android physical device: the machine setting
services.publishForPhysicalDevicesis required (a run with a physical device does not start without it).adb reverseis set up, so an Android build with 127.0.0.1 baked in (the same address as the iOS Simulator build) reaches the server; the Emulator build's 10.0.2.2 does not (the LAN address also works).
3. Things you write yourself
Do not have the AI assistant write them.
- Put secrets such as passwords and tokens in
~/.config/fleetest/secrets/<project>.env. - Containers cannot reach external networks. Write the domains they may reach in
sandbox.allowedDomainsin the machine settings.
When you fix the server, ask the AI to rebuild the image under the same name.
Related:
Next: Testing an app that needs a login