Mobile app testing encompasses the practices, frameworks, and tools used to validate functionality, performance, and usability across iOS and Android platforms. Testing strategies span multiple layers—from unit tests that verify isolated logic to end-to-end tests that simulate real user journeys across devices. The ecosystem includes native frameworks (XCTest, JUnit), cross-platform tools (Detox, Maestro), and cloud-based device farms for scale. A key challenge in mobile testing is the fragmentation of devices, OS versions, and screen sizes, making comprehensive test coverage essential. Understanding when to apply each testing type—balancing speed, reliability, and real-world fidelity—distinguishes effective mobile QA from brittle test suites that slow development.
What This Cheat Sheet Covers
This topic spans 15 focused tables and 132 indexed concepts, 80 flashcards. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
A jump-to index of every table row in this cheat sheet.
An interactive map of every table and concept in this topic.
Table 1: Unit Testing Frameworks
Unit tests are the foundation of any mobile test suite—fast, isolated checks that verify a single function or class behaves correctly. The frameworks here split along platform lines: XCTest and Quick/Nimble for Swift, JUnit and Robolectric for Android, Jest for React Native, plus the mocking libraries (Mockito, OCMock, Cuckoo) you reach for when a unit depends on collaborators you'd rather fake.
| Framework | Example | Description | |
|---|---|---|---|
func testAddition() { XCTAssertEqual(calculator.add(2, 3), 5)} | • Apple's native testing framework for Swift and Objective-C • integrated into Xcode with test navigator and code coverage tools | ||
public void testMultiplication() { assertEquals(6, calculator.multiply(2, 3));} | • Industry-standard Java testing framework for Android unit tests • uses annotations like @Test, @Before, and @After. | ||
void testDivision() { assertThrows(ArithmeticException.class, () -> calc.divide(5, 0));} | • Modern JUnit version with parameterized tests, nested test classes, and improved extension model • preferred for new Android projects | ||
test('formats currency', () => { expect(formatCurrency(1234.5)).toBe('$1,234.50');}); | • JavaScript testing framework widely used for React Native unit tests • includes mocking, snapshot testing, and watch mode | ||
it("validates email format") { expect(validator.isValid("test@example.com")).to(beTrue())} | • BDD-style testing framework for iOS with expressive matchers • popular alternative to XCTest for Swift projects | ||
public void clickButton_shouldNavigate() { button.performClick(); assertNotNull(shadowOf(activity).getNextStartedActivity());} | • Android testing framework that runs tests in the JVM without an emulator • faster than instrumented tests but limited Android API fidelity | ||
UserRepository mockRepo = mock(UserRepository.class);when(mockRepo.getUser(1)).thenReturn(testUser);verify(mockRepo).getUser(1); | • Java mocking framework for creating test doubles • essential for isolating units under test from dependencies in Android | ||
id mockService = OCMClassMock([DataService class]);OCMStub([mockService fetchData]).andReturn(testData); | • Objective-C mocking library for iOS • supports partial mocks and method stubbing for legacy codebases | ||
let mockService = MockDataService()stub(mockService) { mock in when(mock.fetchData()).thenReturn(testData)} | • Swift mocking framework with type-safe stubs and verification • generates mocks via code generation | ||
let expectation = XCTestExpectation(description: "API call")apiClient.fetch { _ in expectation.fulfill() }wait(for: [expectation], timeout: 5.0) | • XCTest mechanism for testing asynchronous code • waits until expectations are fulfilled or timeout occurs |