Run Unit Tests
run_unit_testsRuns unit tests for iOS or Android projects, returning pass/fail counts, failing test names, and error messages.
Instructions
Run the unit-test target for the project. Returns structured results: pass/fail counts, failing test names, first-line failure messages. Long-running — default timeout 30 minutes.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| module | No | Android only: Gradle module name. Default: "app". | |
| scheme | No | iOS only: Xcode scheme name. Required for iOS. | |
| variant | No | Android only: Build variant (e.g., "debug", "release"). Default: "debug". | |
| platform | Yes | Target mobile platform | |
| testPlan | No | iOS only: Optional xcodebuild -testPlan name to run a specific test plan. | |
| timeoutMs | No | Max test-run duration in ms. Default: 1800000 (30 minutes). | |
| gradleTask | No | Android only: Explicit Gradle task (e.g., "test", "connectedCheck"). Default: test<Variant>UnitTest (derived from variant). | |
| testFilter | No | Android only: Value forwarded to `--tests` (e.g., "com.example.MyTest" or "com.example.*"). Omit to run all tests. | |
| destination | No | iOS only: xcodebuild -destination value. Defaults to the iOS Simulator for the first matching runtime. | |
| onlyTesting | No | iOS only: Array of test identifiers to restrict the run. Each entry maps to xcodebuild -only-testing:<Target>/<Class>[/<Method>]. | |
| projectPath | No | Absolute path to the project. iOS: .xcodeproj (required if workspacePath omitted). Android: Gradle project root containing ./gradlew (required). | |
| configuration | No | iOS only: Build configuration (e.g., "Debug", "Release"). Default: "Debug". | |
| workspacePath | No | iOS only: Absolute path to a .xcworkspace. Takes precedence over projectPath. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| output | Yes | Truncated stdout/stderr from the test run | |
| passed | Yes | True when the run finished cleanly with zero failing tests | |
| failures | Yes | Failing tests with first-line messages (may be empty) | |
| platform | Yes | ||
| reportDir | No | Android only: directory containing the JUnit XML reports that were parsed | |
| durationMs | Yes | Total test-run wall clock time in ms | |
| totalTests | Yes | Total tests executed | |
| failedTests | Yes | Tests that failed | |
| passedTests | Yes | Tests that passed | |
| skippedTests | No | Tests reported as skipped, if the tool emits that information | |
| resultBundlePath | No | iOS only: path to the .xcresult bundle written by xcodebuild |