Back to the curriculum

L1-M07 · Level 1 · ~30 h

Test Framework Engineering with Pytest

What you build: Reusable test framework

lessons
5
lesson hours (estimate)
≈ 14.5 h
lessons with a public video
5/5
0/5 lessons marked done · Progress is saved in this browser only. No account, nothing is sent to a server.
In review. The curriculum, module overviews and Levels 1–3 lessons are drafts written with AI assistance and reviewed by AI. Human review is still pending. English translation: AI-assisted, not human-reviewed.

Levels 1–3 lessons, exercises and quizzes are published as drafts, in Vietnamese with an AI-assisted English translation. They may change after human review.

Module path

  1. Lesson 1 · L1-M07-L01≈ 3 hVideo

    Framework structure: pyproject, fixtures, parametrize and markers at scale

    What you build: Scaffolds the capstone repository

    Needs: L1-M06-L05

    Key terms (6)
    • Test frameworkBộ khung test dùng chung
    • src layoutBố cục đặt code trong thư mục `src/`
    • MarkerNhãn để chọn nhóm test
    • Fixture scopePhạm vi sống của fixture
    • TeardownDọn dẹp sau test
    • Smoke testBộ test nhanh, kiểm tra những gì quan trọng nhất
  2. Lesson 2 · L1-M07-L02≈ 3 hVideo

    Configuration, secrets and provider abstraction

    What you build: Swappable mock/live client behind one interface

    Needs: L1-M07-L01

    Key terms (5)
    • Configuration / settingsCấu hình
    • SecretBí mật (key, mật khẩu)
    • Interface / implementationGiao diện / cài đặt
    • Contract testTest hợp đồng: điều mọi cài đặt phải làm
    • Test-firstViết test trước khi sửa code
  3. Lesson 3 · L1-M07-L03≈ 3.5 hVideo

    End-to-end tests for chat UIs with Playwright

    What you build: Playwright tests that drive a chat page and check the reply

    Needs: L1-M07-L02

    Key terms (6)
    • End-to-end (E2E) testTest đầu-cuối qua giao diện thật
    • LocatorCách tìm phần tử trên trang
    • Web-first assertionAssertion tự chờ và thử lại
    • Headless / headedChạy ẩn / hiện trình duyệt
    • TraceBản ghi từng bước của một lần chạy
    • XSS (cross-site scripting)Chèn mã chạy trong trình duyệt người dùng
  4. Lesson 4 · L1-M07-L04≈ 3 hVideo

    Reports and CI with GitHub Actions, with cost control

    What you build: JUnit/JSON reports; mock tests on every push, live tests on demand

    Needs: L1-M07-L03

    Key terms (6)
    • CI (continuous integration)Tích hợp liên tục
    • Workflow / job / stepQuy trình / công việc / bước
    • TriggerSự kiện kích hoạt
    • ArtifactTệp kết quả được lưu lại
    • Environment (protected)Môi trường có bảo vệ
    • Fail closedLỗi thì coi là không đạt
  5. Lesson 5 · L1-M07-L05≈ 3 hVideo

    Using AI tools in QA work safely (coding assistants, MCP)

    What you build: Uses an AI assistant to draft tests, then reviews and verifies them

    Needs: L1-M07-L04

    Key terms (6)
    • Coding assistantTrợ lý lập trình AI
    • OverrelianceTin tưởng quá mức
    • Mutation testing / mutantKiểm thử đột biến / bản code có lỗi cố ý
    • Killed / survivedBị bắt / sống sót
    • MCP (Model Context Protocol)Giao thức kết nối model với tool và dữ liệu
    • Least privilegeQuyền tối thiểu

A. Module overview

Field Value
Module ID L1-M07
Level 1 - AI QA Engineer
Description Building a test framework for an LLM feature: pytest structure, configuration and secrets, one interface with mock and live clients, contract tests, UI tests for the chat page with Playwright (including LLM05 risk), JUnit reports and three-tier CI on GitHub Actions, and how to use AI assistants in QA with mutation checks. This is the foundation of the Level 1 capstone.
Why this module matters Tests scattered across many labs do not protect a product. A framework that runs with one command, is safe by default and runs automatically on CI does.
Target professional competencies Level 1: "a pytest framework with CI", "Playwright UI tests for chat interfaces", "using AI tools in QA work with verification".
Estimated duration 5 lessons (165 + 165 + 195 + 165 + 165 minutes) ≈ 14.3 hours + module assignment ~14 hours + quiz 0.5 hours ≈ 29-30 hours for someone new to Python. Estimate, not yet measured with real learners.
Prerequisites L1-M01 to L1-M06. No API key needed. Browsers must be downloaded for Playwright (about 100-200 MB).
Module output Reusable test framework (aiqa) with a UI test pack for ShopEasy chat v2
Cost 0 VND (the live job is optional and has not been run)

B. Learning objectives

ID Objective
MO1 Configure a pytest framework with markers, shared fixtures and safe defaults.
MO2 Design configuration and secrets, and verify mock and live clients with the same contract tests.
MO3 Write end-to-end tests for a chat interface with Playwright, including LLM05 risk.
MO4 Set up reporting and multi-tier CI with cost control.
MO5 Verify AI-written tests and use AI assistants with least privilege.

C. Lessons

ID Lesson Duration Prerequisites Concepts Hands-on output
L1-M07-L01 Framework structure 165' L1-M06-L05 pyproject.toml, marker, scope, conftest.py Smoke group
L1-M07-L02 Configuration, secrets and a provider abstraction layer 165' L01 Secret, interface, contract test New configuration rule, test first
L1-M07-L03 End-to-end testing of a chat interface with Playwright 195' L02 role-based locators, expect, LLM05, trace UI tests
L1-M07-L04 Reporting and CI with GitHub Actions 165' L03 JUnit, three-tier workflow, secret, environment Scheduled workflow
L1-M07-L05 Using AI tools in QA safely 165' L04 overreliance, mutation check, MCP, least privilege Rewritten tests, 5/5 mutants

D. Hands-on assignment (module assignment)

Reusable test framework and UI test pack for ShopEasy chat v2 (fictional). Details in exercises.md.

E. Module assessment

Component Weight Content
Knowledge quiz 20% quiz.md: 12 questions, 20 points
Practical assignment 40% Rubric: UI test design + Implementation
Applied QA analysis 20% Rubric: Framework and CI + Defect analysis
Review/reflection 20% Rubric: Reporting + Verification and reflection

Formula: module score = 0.2 × quiz% + 0.8 × assignment rubric score (out of 100). Pass conditions: quiz ≥ 70% and every mandatory acceptance criterion and total ≥ 70%.

F. References

See references.md.

Objective ↔ assessment matrix

Objective Lesson Module quiz Assignment
MO1 L01 Q1, Q2 Smoke group
MO2 L02 Q9 AC6
MO3 L03 Q3, Q6, Q11 AC1-AC3; U1-U8
MO4 L04 Q4, Q7, Q10 AC4, AC5
MO5 L05 Q5, Q8, Q12 Verification; AI usage log