官术网_书友最值得收藏!

Red-Green-Refactor – From Failure Through Success until Perfection

"Knowing is not enough; we must apply. Willing is not enough; we must do."
– Bruce Lee

The Red-Green-Refactor technique is the basis of test-driven development (TDD). It is a game of ping pong in which we are switching between tests and implementation code at great speed. We'll fail, then we'll succeed, and, finally, we'll improve.

We'll develop a Tic-Tac-Toe game by going through each requirement one at a time. We'll write a test and see if it fails. Then, we'll write code that implements that test, run all the tests, and see them succeed. Finally, we'll refactor the code and try to make it better. This process will be repeated many times until all the requirements are successfully implemented.

We'll start by setting up the environment with Gradle and JUnit. Then, we'll go a bit deeper into the Red-Green-Refactor process. Once we're ready with the setup and theory, we'll go through the high-level requirements of the application.

With everything set, we'll dive right into the code—one requirement at a time. Once everything is done, we'll take a look at the code coverage and decide whether it is acceptable or whether more tests need to be added.

The following topics will be covered in this chapter:

  • Setting up the environment with Gradle and JUnit
  • The Red-Green-Refactor process
  • Tic-Tac-Toe's requirements
  • Developing Tic-Tac-Toe
  • Code coverage
  • More exercises
主站蜘蛛池模板: 平陆县| 巴林左旗| 博爱县| 剑阁县| 牡丹江市| 昭觉县| 栾城县| 定安县| 闵行区| 丰顺县| 岢岚县| 和顺县| 长泰县| 宁城县| 德兴市| 皮山县| 鄂托克前旗| 礼泉县| 沧州市| 鄢陵县| 昌邑市| 吉木萨尔县| 徐州市| 抚顺县| 康平县| 沽源县| 双江| 喀喇沁旗| 木里| 洪洞县| 伊春市| 鸡西市| 固安县| 册亨县| 津市市| 宜兴市| 绥棱县| 吉首市| 安平县| 保靖县| 新晃|