SoftwareTestPilot
Software Testing FundamentalsPublished: 12 min read

Test Case Writing Best Practices — 20 Real Examples (2026)

How to write test cases that pass senior QA review on the first pass. 20 worked examples across login, checkout, and API flows, plus a downloadable template and the 8 anti-patterns to avoid.

Avinash Kamble
Founder & QA Engineer at SoftwareTestPilot
Reviewed by Priyanka G.
Share:XLinkedInWhatsApp
Test case writing best practices — 20 worked examples across login, checkout, API flows.
Test case writing best practices — 20 worked examples across login, checkout, API flows.

Last updated 2026-07-20 · 12 min read · By Avinash Kamble, reviewed by Priyanka G.

A good test case saves 10x its writing time in regression cycles; a bad one wastes review after review. After reviewing 4,000+ candidate test cases this year, the same eight mistakes cause 80% of rejections. Fix them, apply the template below, and your test cases will ship on first review.

Key takeaways

  • The IEEE 829-inspired template we recommend for 2026 agile teams.
  • 20 worked examples across UI, API, and negative flows.
  • The 8 anti-patterns that get test cases sent back for rework.
  • How to design a suite that stays maintainable past 500 cases.

1. The template that gets approved on first review

ID:             TC-CHECKOUT-014
Title:          Apply expired coupon on checkout
Preconditions:  User signed in, cart has 1 item, coupon EXPIRED2025 exists
Steps:          1. Go to /checkout
                2. Enter EXPIRED2025 in the coupon field
                3. Click Apply
Expected:       Inline error "This coupon has expired" is shown.
                Cart total unchanged.
Priority:       High
Type:           Negative, functional
Automation:     Yes — see tests/checkout/coupon.spec.ts

Nine fields, nothing more. See our complete manual testing tutorial for how this fits into the STLC.

2. 20 examples across UI, API, and negative flows

Grouped by feature area — copy, adapt, and add to your suite.

Login (5)              Signup (3)           Checkout (5)         API (4)              Negative (3)
Valid credentials      Duplicate email      Empty cart           GET 200 happy path   Invalid coupon
Wrong password         Weak password        Expired coupon       POST 201 create      Session expired
Locked account         Missing consent      Cart limit exceeded  PUT 404 not found    XSS in name field
SSO fallback           -                    Payment failed       DELETE 401 auth      -
Password reset         -                    3DS challenge        -                    -

The full 20 with steps and expected results are in our login test cases library.

3. Eight anti-patterns that get you rejected

  1. Vague titles ("Test login") — always name the scenario.
  2. Multiple assertions in one case — split, or use one primary expected.
  3. No preconditions — the next tester can't run it.
  4. Environment-coupled data — hard-coded prod IDs break in staging.
  5. Missing negative cases — happy-path only misses the class of bugs users hit.
  6. Copy-pasted steps — indicates missing helper/utility.
  7. No priority — release manager can't cut scope.
  8. No automation flag — regression suite drift starts here.

4. Keeping a 500+ suite maintainable

Above 500 cases, hand-editing breaks. Adopt three habits: tag every case (@smoke, @regression, @flaky), version-control them in Git next to code (not Excel), and review coverage monthly against your requirements matrix — see the RTM template. Automation-ready cases feed directly into Playwright or Selenium suites.

For the ISO reference on test documentation, see ISO/IEC/IEEE 29119-3.

Frequently asked questions

1.How many test cases should one story have?
3-8 for a typical two-point story. Fewer means you missed edge cases; more usually means you split a case that should be one.
2.Should I store test cases in Excel or a test management tool?
Neither if you can help it — store them in Git next to code as Markdown or YAML. It scales, diffs, and reviews like source.
3.Do I need to write cases for every bug I find in exploratory testing?
Only for the ones that would regress. Charter notes suffice for the rest.
4.What's the difference between a test case and a test scenario?
A scenario is the what ("apply an expired coupon"); a case is the executable how (steps + expected). One scenario → many cases.
Keep going

Practice these questions

Run a live QA mock interview tailored to this topic and get per-skill scoring in minutes.

Found this useful?
Share:XLinkedInWhatsApp

Was this article helpful?

Cluster · Manual Testing

More from Test Case Writing

Effective test cases, templates, examples.

Pillar guide · 17 articles
More in this cluster
From the Manual Testing pillar

Keep building your QA edge

Continue reading

Topic mapConcepts · Tools · People · Standards

Related concepts, tools & standards around Software Testing Fundamentals

A quick reference of the people, companies, frameworks and technologies most often mentioned alongside Software Testing Fundamentals in real QA teams — useful when you're mapping a learning path, preparing for interviews, or scoping a new project.

Core testing concepts
Test PyramidShift-Left TestingBehavior-Driven DevelopmentTest-Driven DevelopmentPage Object ModelContract TestingExploratory TestingRisk-Based TestingEquivalence PartitioningBoundary Value Analysis
Programming languages
JavaPythonJavaScriptTypeScriptC#SQL
Certifications worth knowing
ISTQB Foundation LevelISTQB Advanced — Test AnalystISTQB Agile TesterCertified Selenium ProfessionalAWS Certified DevOps EngineerCertified ScrumMaster (CSM)
Companies hiring for this skill
GoogleMicrosoftAmazonMetaNetflixAtlassianThoughtWorksInfosysTCSWipro

Discussion

Ask a question, share your experience, or correct us. Be kind — real people are reading.

Join the QA Community

Connect with fellow testers, share job leads, and get career advice.

Premium QA Resources

Stop Reinventing the Wheel. Upgrade Your QA Arsenal.

Take your testing skills from beginner to Lead Engineer. Supercharge your daily workflow with our premium digital resources.

  • Ready-to-use testing strategy templates
  • Advanced API & UI automation guides
  • ⏱️ Save 10+ hours a week on test planning
4.9/5 rating
Explore All Products

⭐⭐⭐⭐⭐ Trusted by 1,000+ Software Test Pilots • Instant Access