A dedicated repository for practicing and mastering Test-Driven Development (TDD) skills. This playground provides a structured environment to improve your TDD workflow and understanding.
Test-Driven Development is a software development approach where you:
- Write a failing test first (Red)
- Write the minimum code to make the test pass (Green)
- Refactor the code while keeping tests passing (Refactor)
This cycle is often called the "Red-Green-Refactor" cycle.
This repository serves as a:
- Practice ground for TDD exercises
- Place to experiment with different testing approaches
- Collection of TDD examples and patterns
- Space to improve code design through testing
This playground supports TDD exercises in multiple languages:
- JavaScript/TypeScript
- Ruby
- Python
Each language has its own setup and test configuration.
- Node.js (v20 or later)
- pnpm (v10.8.1 or later)
- Ruby (v3.2 or later) - for Ruby exercises
- Python (v3.10 or later) - for Python exercises
- Clone this repository
git clone https://github.com/yourusername/tdd-playground.git
cd tdd-playground
- Install pnpm dependencies
pnpm install
- Running tests based on exercise type:
For JavaScript exercises:
pnpm dlx nx test javascript-exercise
For Ruby exercises:
# Install Ruby dependencies
pnpm dlx nx bundle ruby-exercise
# Run tests
pnpm dlx nx test ruby-exercise
For Python exercises:
# Install Python dependencies
pip install uv
pnpm dlx nx install python-exercise
# Run tests
pnpm dlx nx test python-exercise
/javascript-exercise
- JavaScript/TypeScript TDD exercises/ruby-exercise
- Ruby TDD exercises/python-exercise
- Python TDD exercises- Each exercise directory contains its own tests and implementation files
When practicing TDD in this playground:
- Always write the test first
- Keep tests and production code simple
- Make small, incremental changes
- Maintain a clean and readable test suite
- Practice regular refactoring
- Commit after each successful test-code cycle
Feel free to:
- Add new TDD exercises
- Improve existing examples
- Share different testing approaches
- Suggest improvements
This repository includes GitHub Actions workflows that automatically run tests for all exercise types on push and pull requests to the master branch.
MIT License - Feel free to use this playground for your own learning and practice.