Autosana Logo
    Autosana
    • SandboxesBeta
    • Enterprise
    • Pricing
    Contact salesTry for free
    Resources

    Blog

    Insights on automated testing and QA best practices.

    BlogProduct updatesCase studies
    AllComparisonsBest ToolsMobile TestingAI TestingTesting Fundamentals

    Fix bugs, not tests.

    Talk to an expert.

    Book 30 minutes with our team. We'll show you Autosana running on your app.

    Contact sales

    Start building.

    Describe a user journey and watch an agent run it on iOS, Android, and web.

    Try for free
    Autosana

    Catch bugs before your users do.

    Try for free

    Product

    • Platform
    • Use cases
    • Enterprise
    • Pricing

    Resources

    • Docs
    • Case Studies
    • Product Updates
    • Blog

    Company

    • Contact sales
    • Careers
    • LinkedIn

    Trust

    • Status
    • Security
    • SOC 2 Type 1 · Type 2 in review
    • Backed by

    © 2026 Autosana. All rights reserved.

    Autosana Logo
    Autosana
    • SandboxesBeta
    • Enterprise
    • Pricing
    Contact salesTry for free
    Written by
    Read time
    Published
    Autosana

    Catch bugs before your users do.

    Try for free

    Product

    • Platform
    • Use cases
    • Enterprise
    • Pricing

    Resources

    • Docs
    • Case Studies
    • Product Updates
    • Blog

    Company

    • Contact sales
    • Careers
    • LinkedIn

    Trust

    • Status
    • Security
    • SOC 2 Type 1 · Type 2 in review
    • Backed by

    © 2026 Autosana. All rights reserved.

    Autosana Logo
    Autosana
    • SandboxesBeta
    • Enterprise
    • Pricing
    Contact salesTry for free
    Back to Blog
    Blog

    Diff-based test selection for mobile pull requests

    Run the mobile E2E flows a pull request can break, not the whole suite. Path filters, agent selection from the diff, and where each one misses regressions.

    Written by
    Gautam Agarwal
    Read time
    9 min read
    Published
    November 28, 2026
    Diff-based test selection for mobile pull requests

    Key Takeaways

    • Running the whole mobile E2E suite on every pull request gets expensive fast, and the usual fallback, a fixed smoke set, ignores what the PR actually changed.
    • Path filters map changed files to test labels. They are cheap and deterministic, and they miss changes in shared components, dependencies and remote config.
    • An agent reading the diff can catch those indirect effects and write a flow for a new feature, at the cost of a selection that varies between runs.
    • A workable split is smoke plus selected flows on each PR, the full suite on merge, and real devices nightly.
    • Judge any selector by replaying past regressions: did it pick a flow that would have failed?

    Diff-based test selection runs only the end-to-end tests a pull request can plausibly break, chosen from the files and behavior it changes. The selection method decides what slips through. This post compares the three methods mobile teams actually use.

    Why mobile teams stop running the full suite

    A worked example makes the arithmetic concrete. Take a suite of 120 journey flows averaging three minutes each on a cloud simulator. That is 360 device-minutes per pull request on one platform, 720 with Android, before retries. Spread across a handful of parallel devices, the wall-clock time is fine. The bill and the queue are not, especially once coding agents start opening pull requests faster than people do.

    Most teams respond by cutting the PR run to a fixed smoke set of ten or so flows and running everything on merge. That keeps the queue short, and it means a PR that rewrites checkout runs the same ten flows as a PR that changes a settings label. If checkout isn't in the smoke set, the regression is found after merge, by the full run, by whoever is on call.

    Selection is the middle path: run smoke always, plus the flows this particular change could affect. There are three ways to decide what "could affect" means.

    Path filters: changed files to test labels

    The deterministic option maps directories to areas of the app, and areas to test labels. dorny/paths-filter does the mapping in GitHub Actions. Each filter you define sets an output, and its changes output is a JSON array of every filter that matched a changed file. Name the filters after your test labels and the array becomes the label list.

    The filter file, one entry per app area:

    # .github/test-areas.yaml
    checkout:
      - 'src/features/checkout/**'
      - 'src/api/payments/**'
    auth:
      - 'src/features/auth/**'
      - 'ios/App/Keychain*.swift'
    onboarding:
      - 'src/features/onboarding/**'
    everything:
      - 'src/components/**'
      - 'package.json'
      - 'ios/Podfile.lock'
      - 'android/app/build.gradle'

    The workflow turns matched areas into labels, always adding smoke:

    jobs:
      changes:
        runs-on: ubuntu-latest
        permissions:
          pull-requests: read
        outputs:
          areas: ${{ steps.filter.outputs.changes }}
        steps:
          - uses: actions/checkout@v4
          - uses: dorny/paths-filter@v4
            id: filter
            with:
              filters: .github/test-areas.yaml
    
      e2e:
        needs: [changes, build]
        runs-on: ubuntu-latest
        steps:
          - uses: actions/download-artifact@v4
            with: { name: ios-build, path: build }
          - id: labels
            env:
              AREAS: ${{ needs.changes.outputs.areas }}
            run: echo "list=$(echo "$AREAS" | jq -r '. + ["smoke"] | join(",")')" >> "$GITHUB_OUTPUT"
          - uses: autosana/autosana-ci@main
            with:
              api-key: ${{ secrets.AUTOSANA_KEY }}
              platform: ios
              bundle-id: com.example.shop
              build-path: build/Shop.app.zip
              labels: ${{ steps.labels.outputs.list }}

    Two details matter. The everything filter is a label attached to the full suite, so a change to a shared component or a dependency runs all of it. And the matched-area list goes through env: into the shell, following the action's own advice to avoid interpolating PR-derived values directly into a run: script. Labels in Autosana's GitHub Action are resolved when the run starts, so adding a flow to the checkout label later needs no workflow change.

    This works, and it is cheap and reproducible. The same diff always runs the same flows. Its weakness is that it only knows about files.

    Where path filters miss regressions

    Every one of these PRs passes a path-filtered run and can still break checkout:

    A shared hook, outside src/components. useDebouncedSubmit lives in src/lib/hooks, which no filter mentions. Checkout uses it. The PR runs smoke only.

    A string file. A translator shortens "Place order" in locales/de.json, and the German button now wraps onto two lines and pushes the total off screen. The JSON file matches no area.

    A remote config or feature flag. The PR only adds a flag check, and the code path behind the flag is the old checkout. The real change ships later, from a dashboard, with no pull request at all.

    A backend contract. The mobile repo didn't change; the payments API did.

    You can patch the first two by widening filters, and each patch moves you closer to running everything. The last two are outside the diff entirely, which is the argument for the full suite on merge and nightly, whatever you do on PRs. This overview of regression testing covers how to size that full run.

    __wf_reserved_inherit

    Agent selection from the diff

    The second option gives the diff to an agent that reads it the way a reviewer would. It sees that useDebouncedSubmit is imported by the checkout screen, that a German string got shorter, or that a new onboarding step was added with no flow covering it.

    Expo describes this direction for its remote simulators. Its pull request review guide suggests asking an agent to start a session with the PR build, run the changed flow and attach screenshots or a recording. On a recent Expo livestream, the team described CI presets in which the agent reads the code, the diff and the PR description before deciding what to QA, specifically to avoid a generic pass that burns tokens without targeting the change.

    Autosana's GitHub Bot applies the same idea to an existing suite. When a PR opens, it analyzes the diff, selects the relevant flows, editing or creating them as needed, runs them in parallel as the build completes, and posts results with videos as a PR comment and a GitHub Check. Reviewers can reply with @autosana to request specific tests, re-run failures or adjust instructions.

    What an agent buys you:

    • Indirect effects. It follows imports and naming, so a shared hook or a string change can pull in the flows that use them.
    • Intent. The PR description says "fixes double submit on slow networks", which tells it to test the slow path, something no path filter can read.
    • New coverage. A new screen with no flow gets one written, which a label mapping can't do.

    What it costs:

    • Variance. Two runs over the same diff can pick different flows. Ask for the selection and the reason to be posted with the results, so a reviewer can see what was and wasn't run.
    • Tokens and minutes. Reading the diff is cheap next to running flows, but writing new flows on every PR adds up. Let it create flows where coverage is missing, not everywhere.
    • Trust. A green check that ran three flows looks the same as one that ran thirty. The comment has to list them.

    A selection schedule that holds up

    None of these is enough alone, so most teams that do this well combine them by event:

    EventWhat runsWhy
    Pull requestSmoke, plus flows selected from the diffFast feedback on the change itself
    @autosana comment or labelWhatever the reviewer asks forThe reviewer knows something the selector doesn't
    Merge to mainFull suite on simulators and emulatorsCatches what selection missed
    NightlyFull suite plus real devicesRemote config, backend drift, hardware

    The merge run is the safety net that makes selective PR runs acceptable. Without it, selection is just running fewer tests. For how results from these runs should show up on the PR itself, see E2E test results on the pull request.

    For the pipeline around them, read designing a CI/CD pipeline that survives mobile testing.

    __wf_reserved_inherit

    Measuring a test selector against past regressions

    "It picked sensible tests" isn't a measurement. A selector has one job: include at least one failing flow whenever the change breaks something. You can test that before trusting it.

    Take the last twenty or so regressions your full suite caught after merge, the ones where a flow went red on main. For each, check out the PR that introduced it and run the selector on its diff. Record whether the selected set contained the flow that later failed. That ratio, regressions caught at PR time over regressions that existed, is the number to compare between path filters, an agent and a fixed smoke set.

    Expect path filters to miss most of the shared-code and string regressions and an agent to catch more of them, with some misses of its own. Expect neither to catch remote config or backend changes, which is why the merge and nightly runs stay. The smoke testing guide covers what belongs in the always-on set.

    Conclusion

    Selecting tests from the diff trades completeness at PR time for speed, and the full run on merge pays back the difference. Path filters are cheap and predictable and only see files. An agent reading the diff sees imports, strings and intent, and needs to show its work.

    Start with smoke plus path-filtered labels, add agent selection where filters keep missing, keep the full suite on merge, and measure the selector against real regressions, not against how reasonable its choices look.

    __wf_reserved_inherit

    FAQs

    What is diff-based test selection?

    Running only the tests a pull request can affect, chosen from what the change touches.

    Can GitHub Actions run E2E tests only for changed files?

    Yes. dorny/paths-filter maps changed paths to outputs you can turn into test labels.

    What do path filters miss?

    Shared code outside the mapped folders, string files, remote config, feature flags and backend changes.

    Can an AI agent choose which tests to run on a PR?

    Yes. It reads the diff and description, then picks or writes relevant flows.

    Should the full suite still run?

    Yes, on merge and nightly. It catches what selection misses.

    How does Autosana choose tests for a pull request?

    Its GitHub Bot analyzes the diff, selects or creates relevant flows, and posts results.

    Sources

    • dorny/paths-filter on GitHub
    • Expo: Review a pull request on a remote Android Emulator or iOS Simulator

    ‍

    Fix bugs, not tests.

    Talk to an expert.

    Book 30 minutes with our team. We'll show you Autosana running on your app.

    Contact sales

    Start building.

    Describe a user journey and watch an agent run it on iOS, Android, and web.

    Try for free
    Autosana

    Catch bugs before your users do.

    Try for free

    Product

    • Platform
    • Use cases
    • Enterprise
    • Pricing

    Resources

    • Docs
    • Case Studies
    • Product Updates
    • Blog

    Company

    • Contact sales
    • Careers
    • LinkedIn

    Trust

    • Status
    • Security
    • SOC 2 Type 1 · Type 2 in review
    • Backed by

    © 2026 Autosana. All rights reserved.