From 7c2658d0edc88a6a87024df408d42e0b61cd6c60 Mon Sep 17 00:00:00 2001 From: Gustavo Martin Morcuende Date: Sun, 27 Nov 2016 15:17:07 +0100 Subject: [PATCH] README file --- TDD/README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 TDD/README.md diff --git a/TDD/README.md b/TDD/README.md new file mode 100644 index 0000000..12e4c51 --- /dev/null +++ b/TDD/README.md @@ -0,0 +1,17 @@ +Sandro Mancuso: testing a refactoring legacy code + +Rules for refactoring legacy code. + +1. You may not change production code if not covered by tests. Before refactoring some legacy code we must write a Unit Test for it. + + But some times for writing the test we must make modifications in the legacy code. If such modifications are required: just automated refactoring (via IDES) are allowed, if needed to write the test. + + +Steps: + +1. Start testing the legacy code following the shortest branch. + +2. In Unit Test we should not invoke other classes but the one being under test (the other classes should be stub, mocke, etc, etc) + +3. When the legacy code is covered by a unit test we may refactor it (never before) We have to refactor our legacy code from the deepest to the shortest branch. + -- 2.1.4