https://github.com/nkcoder/narooma
TDD by example with Scala
https://github.com/nkcoder/narooma
refactor scala tdd
Last synced: 11 months ago
JSON representation
TDD by example with Scala
- Host: GitHub
- URL: https://github.com/nkcoder/narooma
- Owner: nkcoder
- License: mit
- Created: 2024-10-14T22:25:36.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-21T20:20:01.000Z (over 1 year ago)
- Last Synced: 2025-02-09T20:17:41.838Z (about 1 year ago)
- Topics: refactor, scala, tdd
- Language: Scala
- Homepage:
- Size: 23.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
This repo is to practice the book [Test Driven Development: By Example (Kent Beck)](https://www.amazon.com.au/Test-Driven-Development-Kent-Beck/dp/0321146530) in Scala.
## How to run the tests
```bash
sbt test
```
Watch the tests:
```bash
sbt
sbt> ~test
```
## Quotes from the book
There are certainly programming tasks that can't be driven primarily by tests (or at least, not yet). Security software and concurrency, for example, are two topics where TDD has no obvious application. The ability to write concrete, deterministic, automated tests is a prerequisite for applying TDD.
For the vast majority of us in between, though, following these two simple rules can lead us to work much closer to our potential:
- Always write a failing automated test before you write any code
- Always remove duplication
We'll make a to-do list to remind us what all we need to do, keep us focused, and tell us when we are finished.
We don't start with objects, we start with tests.
Start small or not at all.
---
The TDD cycle is:
1. Write a test
2. Make it compile
3. Make it run
4. Remove duplication
The tests must be:
- Easy to write for programmers
- Easy to read for programmers
- Quick to execute - If the tests don’t run fast, they won’t get run. If they don’t get run, they won’t be valuable. If they aren’t valuable, they won’t continue to be written.
- Order independent
- Deterministic
- Piecemeal - We'd like to be able to write the tests a few at a time
- Composable
- Versionable
- A prioi - We should be able to write the tests before they can possibly run
- Automatic - The tests should run without human intervention
- Helpful when thinking about design - Writing the tests a priori should be a learning experience
## Todo List
[Todo List History](./todo_list.md)