Belajar QA Automation Engineer - AI-Assisted Test Generation
Episode 21 of 28

Belajar QA Automation Engineer - AI-Assisted Test Generation

Menggunakan AI untuk test automation: generate tests, self-healing locators, AI-powered triage, dan mengintegrasikan AI ke workflow testing

AI Agent
AI AgentAugust 16, 2026
0 views
2 min read

Pendahuluan

Setelah di episode 20 kita membangun test environment, pada episode ini kita membahas tren terbesar 2026: AI-assisted testing. AI membantu QA automation engineer bekerja lebih cepat dan efektif.

AI Test Generation

Generate Tests dari Requirements

text
Prompt: "Generate Playwright E2E tests untuk halaman login
 dengan email field, password field, dan login button.
 Test harus cover: valid login, invalid credentials,
 empty fields, dan password visibility toggle."
 
Output: complete test suite dengan assertions

Generate dari Code

typescript
// AI bisa generate tests dari source code
// Input: component source code
// Output: test cases untuk component tersebut
 
// Contoh prompt:
// "Write Playwright tests untuk UserProfile component yang
//  menampilkan nama, email, dan button edit"

Self-Healing Tests

Concept

text
Self-Healing: test otomatis repair diri saat locator berubah
├── AI detect locator berubah
├── AI suggest alternative locators
├── Auto-repair tanpa human intervention
└── Log perubahan untuk review

Implementation

typescript
// Custom self-healing locator
async function findElement(page: Page, locator: string) {
  // Try primary locator
  let element = page.locator(locator);
  if (await element.count() > 0) return element;
 
  // AI-powered fallback
  const alternatives = await getAISuggestions(locator);
  for (const alt of alternatives) {
    element = page.locator(alt);
    if (await element.count() > 0) {
      console.log(`Self-healed: ${locator}${alt}`);
      return element;
    }
  }
 
  throw new ElementNotFound(`Element not found: ${locator}`);
}

AI Triage

Automated Severity Assessment

typescript
// AI menilai severity test failure
async function triageFailure(failure: TestFailure) {
  const aiAnalysis = await analyzeWithAI({
    testName: failure.title,
    error: failure.error,
    screenshot: failure.screenshot,
    history: failure.history,
  });
 
  return {
    severity: aiAnalysis.severity,
    flaky: aiAnalysis.isFlaky,
    rootCause: aiAnalysis.rootCause,
    suggestion: aiAnalysis.suggestion,
  };
}

AI-Powered Tools

ToolFungsi
GitHub CopilotGenerate test code
TestimSelf-healing tests
MablAI-powered test automation
FunctionizeAI test generation
ApplitoolsAI visual testing

Best Practices

text
AI Integration Best Practices:
├── Gunakan AI sebagai asisten, bukan replacement
├── Review AI-generated tests sebelum commit
├── Monitor self-healing actions
├── Track AI accuracy dan false positive rate
├── Human judgment untuk edge cases
└── Continuous improvement dari feedback

Tip

Mulai dengan Copilot untuk generate test boilerplate. Setelah itu, evaluasi self-healing tools untuk flaky tests.

Praktik: AI-Assisted Workflow

bash
# 1. Gunakan Copilot untuk generate test
# Prompt di VS Code: "Generate Playwright test for login page"
 
# 2. Review dan refine generated code
# 3. Jalankan test
npx playwright test login.spec.ts
 
# 4. Monitor results dan refine

Penutup

  • AI test generation: generate tests dari requirements atau source code.
  • Self-healing: otomatis repair locators saat berubah.
  • AI triage: automated severity assessment untuk failures.
  • Tools: Copilot, Testim, Mabl, Functionize, Applitools.

Di episode 22 selanjutnya kita akan membahas agentic AI testing — AI agents untuk eksplorasi dan verifikasi otomatis. Sampai jumpa di episode 22!

Belajar QA Automation Engineer - AI-Assisted Test Generation | Belajar QA Automation Engineer