Section 5 — AI-Powered Testing + CI/CD Integration
Summary — what this page covers Closing the loop on quality: use Claude Code to generate comprehensive xUnit suites and find edge cases, run real-dependency integration tests with TestContainers, then run Claude headless in GitHub Actions for automated AI code review and release notes. This section also carries a Day 1 steering touchpoint — framing the CI review as a reusable skill and logging skill usage with a hook. Pair with Lab 5.
3:30 – 4:15 PM · 45 min — 20 min lecture/demo + 25 min lab
Learning objectives
- Generate comprehensive xUnit suites for Day 2 features with Claude Code
- Apply AI edge-case analysis to find untested scenarios
- Write integration tests with TestContainers (SQL Server + Qdrant)
- Run Claude Code headless in GitHub Actions (
--no-interactive) - Build an automated AI code-review workflow that comments on PRs
- Generate release notes from commit history
Content
Block 5A — AI-powered testing (≈20 min)
Generate tests. Describe what needs testing, not how — Claude reads the implementation and
writes the cases. For the agent loop, that's the happy path, a multi-tool run, a tool error, and a
CancellationToken path. A starting prompt:
Generate xUnit tests for AgentService using the patterns in BookTracker.Tests and NSubstitute.
Cover: happy path, a multi-tool run, a tool that errors, and a cancelled CancellationToken.
Edge-case discovery. Switch Claude into an "adversarial test engineer" and it reliably
surfaces the cases you didn't think of — null messages, rate-limit handling, session-id collisions,
deserialization failures, missing CancellationToken propagation:
You are an adversarial test engineer. Find the untested edge cases in AgentService that could
break in production, then write failing tests that expose them.
TestContainers. Spin up real SQL Server + real Qdrant in Docker for integration tests — no mocks, the actual stack. Slower, but it catches what mocks hide.
Block 5B — CI/CD integration (≈25 min)
Claude Code in GitHub Actions. Run Claude headless (--no-interactive) on the PR diff,
review for security / .NET issues / missing error handling / CLAUDE.md violations, format as GFM, and
post it as a PR comment. Cost optimization: use claude --model claude-haiku-4-5 for CI reviews —
it's the right tier for mechanical review work and keeps CI cheap.
Automated release notes. On tag push, collect commits since the previous tag (git log $PREV..HEAD) and pipe them through Claude to produce grouped notes (What's New / Bug Fixes /
Breaking Changes / Developer Notes). Haiku again, to keep it cheap.
CI/CD guardrails. Keep the workflow YAML as reference — prioritize getting the testing demo and lab working; the CI pieces are provided so you can wire them quickly.
Steering touchpoint (from Day 1 Section 2): the CI review is a textbook code quality & review skill — the playbook lives in
.claude/skills/, and you trigger the same structured review in CI that you run locally with/code-review. To learn which skills your team actually uses, register aPreToolUsehook that logs skill invocations — the same pattern Anthropic uses internally to find under-triggering skills. One slide; connect it explicitly.
Demos referenced here
- Generate a test suite for
AgentService(happy path → adversarial edge cases) · The GitHub Actions AI review commenting on a live PR. [Scripts in_instructor/.]
→ Continue to Lab 5.