Modern QA2026Your First QA Script
Log inJoin
1 / 3 · Book 12 · Your First Program · drill: interview Q&A⊞ allnext →Get the book →

1.6Your First QA Script

A script that prints a test result summary. This is closer to real work than "hello world."

# test_summary.py
test_name = "Login API"
status_code = 200
passed = status_code == 200

print(f"Test: {test_name}")
print(f"Status: {status_code}")
print(f"Result: {'PASS' if passed else 'FAIL'}")
// test_summary.js
const testName = "Login API";
const statusCode = 200;
const passed = statusCode === 200;

console.log(`Test: ${testName}`);
console.log(`Status: ${statusCode}`);
console.log(`Result: ${passed ? "PASS" : "FAIL"}`);
// test_summary.ts
const testName: string = "Login API";
const statusCode: number = 200;
const passed: boolean = statusCode === 200;

console.log(`Test: ${testName}`);
console.log(`Status: ${statusCode}`);
console.log(`Result: ${passed ? "PASS" : "FAIL"}`);

Why This Matters for QA: Every test automation framework produces output like this. Understanding how to construct strings, evaluate conditions, and print results is the foundation of every test report, every CI log, and every Slack notification your pipeline sends.