Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

Mobile Performance Testing

БесплатноБез исполняемых скриптовНе проверен

Mobile application performance testing including app launch time, frame rendering, memory profiling, battery consumption, network throttling, and crash…

PramodDuttaот PramodDutta★ 253 звезды на GitHub

Об этом скилле

Mobile Performance Testing Skill

You are an expert in mobile application performance testing. When the user asks you to test mobile app performance, measure launch times, profile memory usage, test under network conditions, or set up mobile performance monitoring, follow these detailed instructions.

Core Principles

  1. Real device testing over emulators -- Performance measurements on emulators do not represent real-world behavior. Always validate on real devices with representative hardware.
  2. Cold start and warm start measurement -- Measure both cold start (app loaded from scratch) and warm start (app resumed from background) times. Users experience both.
  3. Frame rendering performance -- Target 60fps (16.6ms per frame) for smooth UI. Measure jank frames, frozen frames, and total frame drop percentage.
  4. Memory profiling under load -- Monitor memory allocation, peak usage, and garbage collection frequency during typical and stress scenarios.
  5. Network-aware performance -- Test on 2G, 3G, 4G, and WiFi conditions. Many users operate on slow or unreliable connections.
  6. Battery consumption measurement -- Track CPU wake locks, network activity, GPS usage, and background processing that drain battery.
  7. Baseline comparison -- Every performance test must compare against a baseline from the previous release to detect regressions.

Project Structure

mobile-perf-tests/
  android/
    launch-time/
      cold-start.test.ts
      warm-start.test.ts
      deep-link-start.test.ts
    rendering/
      frame-rate.test.ts
      scroll-performance.test.ts
      animation-jank.test.ts
    memory/
      memory-leak-detection.test.ts
      large-list-memory.test.ts
      image-cache-memory.test.ts
    network/
      slow-network.test.ts
      offline-mode.test.ts
      large-payload.test.ts
    battery/
      background-drain.test.ts
      location-tracking-drain.test.ts
  ios/
    launch-time/
      cold-start.test.ts
      warm-start.test.ts
    rendering/
      frame-rate.test.ts
      scroll-performance.test.ts
    memory/
      memory-warnings.test.ts
      image-cache.test.ts
  helpers/
    performance-collector.ts
    adb-helper.ts
    network-throttler.ts
    metrics-reporter.ts
  baselines/
    android-baseline.json
    ios-baseline.json
  config/
    device-profiles.ts
    performance-thresholds.ts
  reports/
    .gitkeep

App Launch Time Testing

// android/launch-time/cold-start.test.ts
import { describe, it, expect, beforeAll, afterAll } from 'vitest';

interface LaunchMetrics {
  coldStartMs: number;
  timeToFirstFrameMs: number;
  timeToInteractiveMs: number;
  totalDrawnFrames: number;
}

describe('Android Cold Start Performance', () => {
  const APP_PACKAGE = 'com.example.app';
  const LAUNCH_ACTIVITY = '.MainActivity';
  const ITERATIONS = 10;
  const THRESHOLD_MS = 2000;

  it('should launch within threshold on average', async () => {
    const measurements: number[] = [];

    for (let i = 0; i < ITERATIONS; i++) {
      // Force stop the app
      await execAdb(`shell am force-stop ${APP_PACKAGE}`);
      await sleep(2000);

      // Clear app from memory
      await execAdb(`shell pm clear ${APP_PACKAGE}`);
      await sleep(1000);

      // Measure cold start
      const output = await execAdb(
        `shell am start-activity -W -n ${APP_PACKAGE}/${LAUNCH_ACTIVITY}`
      );

      const totalTime = parseLaunchTime(output);
      measurements.push(totalTime);
    }

    const average = measurements.reduce((a, b) => a + b, 0) / measurements.length;
    const p95 = measurements.sort((a, b) => a - b)[Math.floor(measurements.length * 0.95)];
    const max = Math.max(...measurements);

    console.log(`Cold start: avg=${average.toFixed(0)}ms, p95=${p95}ms, max=${max}ms`);

    expect(average).toBeLessThan(THRESHOLD_MS);
    expect(p95).toBeLessThan(THRESHOLD_MS * 1.5);
  });

  it('should render first frame within 1 second', async () => {
    await execAdb(`shell am force-stop ${APP_PACKAGE}`);
    await sleep(2000);

    const startTime = Date.now();
    await execAdb(`shell am start-activity -W -n ${APP_PACKAGE}/${LAUNCH_ACTIVITY}`);

    const output = await execAdb('shell dumpsys gfxinfo ' + APP_PACKAGE);
    const firstFrameTime = parseFirstFrameTime(output);

    expect(firstFrameTime).toBeLessThan(1000);
  });

  it('should show improvement over baseline', async () => {
    const baseline = await loadBaseline('cold-start');
    const current = await measureColdStart();

    const regression = ((current - baseline) / baseline) * 100;
    console.log(`Baseline: ${baseline}ms, Current: ${current}ms, Change: ${regression.toFixed(1)}%`);

    expect(regression).toBeLessThan(10); // Allow up to 10% regression
  });
});

async function execAdb(command: string): Promise<string> {
  const { execSync } = await import('child_process');
  return execSync(`adb ${command}`, { encoding: 'utf-8' });
}

function parseLaunchTime(output: string): numbe
Полный SKILL.md на GitHub

Установить Mobile Performance Testing в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл Mobile Performance Testing?

Mobile application performance testing including app launch time, frame rendering, memory profiling, battery consumption, network throttling, and crash analytics using Appium, XCTest, and Espresso with real device testing.

Как установить скилл Mobile Performance Testing?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл Mobile Performance Testing запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить Mobile Performance Testing с