Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

🧪 Lab 05 - Test Strategy Upgrade

🎯 Objective

Upgraded a Python test strategy by separating unit and integration tests, improving assertions, organizing fixtures, and measuring coverage with pytest-cov.

📚 Prerequisites

  • Basic understanding of Python programming
  • Familiarity with Git and version control
  • Knowledge of basic testing concepts (unit tests, assertions)
  • Experience with command-line operations in Linux
  • Understanding of software development lifecycle

🖥️ Lab Environment

  • Operating System: Ubuntu 24.04 LTS cloud lab environment
  • Primary User: toor
  • Python Runtime: Python 3.12.x in a virtual environment

✅ Learning Objectives Covered

  • Implement a multi-layered testing strategy for Python applications
  • Create unit tests for individual components
  • Develop integration tests for component interactions
  • Improve test assertions for better failure diagnostics
  • Understand test coverage metrics and reporting

🧩 Task Overview

This lab was completed through the following high-level activities:

  • Step 1: Create the Application Structure
  • Step 2: Implement Core Application Components
  • Step 3: Create Test Configuration
  • Step 1: Create Unit Tests for Models
  • Step 2: Create Unit Tests for Inventory Manager
  • Step 1: Create Integration Tests for Order Processing
  • Step 2: Run Tests with Coverage
  • Step 1: Implement All TODO Items

📁 Repository Structure

lab05-test-strategy-upgrade/
├── README.md
├── commands.sh
├── output.txt
├── interview_qna.md
├── troubleshooting.md
└── project/
    pytest.ini
    run_tests.sh
    src/__init__.py
    src/order_system/__init__.py
    src/order_system/inventory.py
    src/order_system/models.py
    src/order_system/processor.py
    tests/__init__.py
    tests/integration/__init__.py
    tests/integration/test_order_processing.py
    tests/unit/__init__.py
    tests/unit/test_inventory.py
    tests/unit/test_models.py

🔍 Verification & Validation

  • Target: Aim for >80% coverage

🧠 What I Learned

  • How to separate fast unit tests from broader integration coverage.
  • How better assertions improve failure diagnostics during debugging.
  • Why Decimal is preferred for monetary calculations in tests and business logic.
  • How coverage reports help identify logic paths that still need attention.

🌍 Why This Matters

Reliable delivery depends on layered testing. Clear test boundaries and descriptive assertions make refactoring safer and reduce uncertainty before releasing changes into higher environments.

🚀 Real-World Applications

  • Order processing or transactional business services.
  • CI pipelines that must prove code quality before deployment.
  • Team-owned Python services requiring repeatable regression checks.

📌 Result

Built a complete testing layout with passing unit tests, integration tests, and measurable coverage.

🏁 Conclusion

This lab strengthened my hands-on foundation in test strategy upgrade and produced a clean set of project files, command history, execution output, interview notes, and troubleshooting guidance for portfolio use.

All code, commands, outputs, and support material used for this lab are organized in this folder for traceability and GitHub documentation readiness.