Concepts in Mobile Dev, page 22

XCUITest: Automating Your App's User Interface
XCUITest is like a robot user for your app, tapping buttons and verifying what's on screen. It automates testing of critical flows like login or checkout to prevent regressions.
CurvedAnimation: Animate with Easing and Personality
CurvedAnimation makes animations feel natural by applying a timing curve to another animation. Instead of linear motion, widgets can ease-in or bounce. Footgun: Elastic curves can overshoot the standard 0.0-1.0 range, causing unexpected UI behavior.
JobScheduler: Efficient, Deferrable Background Tasks
Think of JobScheduler as Android's smart alarm for tasks. You specify conditions like 'Wi-Fi only' or 'charging,' and the OS runs your job efficiently to save battery. Use it for deferrable work like data syncs. Footgun: It's not for exact timing.
React Native Testing Library: Test User Behavior, Not Code
React Native Testing Library tests components from a user's perspective. Instead of checking internal code, you find elements by visible text and simulate presses, ensuring tests survive refactors. The footgun is overusing implementation details like testID.

XCUIElementQuery: The Blueprint for Finding UI Elements
An XCUIElementQuery is a recipe for finding UI, not the element itself. It describes a search that runs only when you interact with the result. Use it in XCUITest to locate views for automated tests. The footgun: thinking a query finds an element on creation.
AnimationController: The Conductor of Your Animation
An AnimationController is the conductor for your animation's timing. It produces values from 0.0 to 1.0 over a duration, letting you play, reverse, or stop animations. Use it to drive widgets like SlideTransition.
Handler and Looper: Android's Threading Backbone
A Looper is a worker that endlessly processes a queue of tasks for a thread. A Handler is how you give that worker a new task from another thread, like updating the UI. The footgun is blocking the main thread's Looper, which freezes your app.

React Native & Jest: Automatic Native Module Mocking
Jest tests for React Native run in Node, not on a device, so native code won't work. The react-native preset automatically mocks native modules, letting you test components without a real device environment.

Testing Async Code with XCTestExpectation
XCTestExpectation is a stopwatch for your tests, pausing them to wait for asynchronous work like a network call to finish. Use it for testing code with completion handlers. The footgun is forgetting to fulfill() the expectation, causing a timeout failure.
Flutter's Tween: The Recipe for Animation
A Tween is a recipe for animation, not the animation itself. It maps a 0.0-1.0 progress value to a concrete value, like a color or position. Use it with an AnimationController to smoothly transition a widget's properties.

The Testing Pyramid: Fast Feedback, Low Cost
The Testing Pyramid guides test suite structure: a wide base of fast unit tests, a smaller middle of integration tests, and a tiny top of slow UI tests. This model is key for Android's local, instrumented, and UI tests. The footgun is inverting it.

The `act()` Utility: Syncing Tests with React's Updates
The act() utility ensures your tests wait for React to finish updating the DOM before you make assertions. Use it to wrap component renders and state updates. The footgun is forgetting to use await with an async function, which can lead to flaky tests.

Xcode Code Coverage: Measuring Test Effectiveness
Code coverage isn't a grade, but a map of untested code. Use it in Xcode to find gaps in your logic before shipping. The footgun: high coverage doesn't mean your tests are good, just that the lines were executed, potentially missing key assertions.
AnimatedBuilder: Isolate Animation Rebuilds for Performance
Flutter's AnimatedBuilder rebuilds only the widgets that change during an animation, not the entire screen. Use it to embed a moving part within a larger static widget, like a spinning icon on a button, to maximize performance.

JUnit on Android: Fast, Local Unit Tests
JUnit on Android runs tests directly on your local machine's JVM, not a device, making them extremely fast. Use it for business logic and ViewModels that don't touch Android APIs. The footgun is trying to access framework code like Context, which will fail.
Testing Custom Hooks with `renderHook`
renderHook isolates a hook for testing by running it inside a tiny, dedicated component. Use it to verify a hook's logic and side effects without rendering a full UI. Footgun: Forgetting to wrap state updates in act() can cause flaky, unpredictable tests.

measure: Baseline and Compare Code Performance
measure in XCTest establishes a performance baseline for a block of code and fails tests if it regresses. It tracks critical algorithm speed, running the code ten times for a stable average. The footgun is ignoring the baseline: you must set it first.
CustomPaint: Drawing Your Own Widgets in Flutter
CustomPaint is your blank canvas widget; CustomPainter is the artist that draws on it. Use them for custom charts or unique UI. The footgun: shared canvases can cause blend modes to erase other widgets, so use saveLayer sparingly.
Truth: Fluent Assertions for Clearer Tests
Truth makes tests read like English: assertThat(actual).is.... It provides clearer assertions than standard JUnit, with far more helpful failure messages, especially for collections. The main footgun is a potential Guava dependency conflict.
Detox: Gray-Box E2E Testing for React Native
Detox runs gray-box E2E tests by automatically synchronizing with your React Native app's activity. This eliminates flaky sleep() calls. Write one JavaScript test suite for iOS and Android that runs reliably on CI and real devices.
We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.
See open roles