These learning resources primarily focus on Test Driven Development (TDD).
- There is an emphasis on learning using PHP, Laravel and PHPUnit.
- All these resources are free (at the time of writing)
- 1. Videos
- 2. Blog Posts
- 3. Books, manuals and websites
- 4. Tooling
- 5. Three Laws of TDD
- 6. Examples & Code Kata
- 7. Project with Tests
- 8. Conclusion
- 9. Other Learning Plans
- 10. License
- TDD: The Good Parts - Adam Wathan: A talk I recently gave at the Laravel Toronto meet up.
- APIs in Laravel Using TDD - TDD course by Devlob Notes (Gist)
- PHPUnit Testing - TDD course by Bitfumes Webnologies Notes (Gist)
- The Three Laws of TDD (Featuring Kotlin) - A hand-on demo of Test Driven Development using the Kotlin language, by Uncle Bob
- Chasing "Perfect" - Adam Wathan - Laracon EU 2015 - Real time coding clean code, using tests at every step of the process.
- geepawhill.org - TDD & The Lump Of Coding Fallacy
- PHP UK Conference 2017 - Anna Filina - Unit Testing by Example - PHP UK Conference 2017. Presentation giving realistic and pragmatic examples.
- Jeffrey Way - Laravel Testing Tips, Techniques and Pitfalls - Presentation from Laracon EU Oct 2013
- Is TDD Dead? - A series of conversations between Kent Beck, David Heinemeier Hansson (DHH), and Martin Fowler on the topic of Test-Driven Development (TDD) and its impact upon software design.
- Is TDD dead? Of course not! But what´s all the fuzz about then? Emily Bache - Emily Bache talks about DHH's blog
- Laravel 5.8 Tutorial From Scratch - e49 - Testing 101 Using PHPUnit - Testing is an integral part of modern PHP development. Let's work to get our customer controller under test. Notes (Gist)
- YouTube - Test Driven Laravel - TDD in Laravel by Coder's Tape (Notes (Gist)
- Test Driven Laravel from Scratch - Adam Wathan: walk through using outside-in TDD Notes (Gist)
- Devlob blog - 7 TDD Advantages with Real Life Examples
- Devlob blog - 7 Reasons to NOT Use TDD
- The Clean Code Blog by Robert C. Martin (Uncle Bob)
- geepawhill.org TDD - 57 categories on TDD
- Start testing your Laravel applications (Jason McCreary)
- Lowering the time cost of testing existing Laravel applications (Jason McCreary)
- What is Software Testing and Why do we Test Software? eviltester.com - 9 min read with 9 min video.
- butunclebob.com - TheThreeRulesOfTdd
- PHPUnit Manual
- wikipedia.org Test driven development
- MartinFowler.com testing culture
- Simple TDD in Laravel with 11 steps - Medium by Jeff Simons Decena
- Repository pattern with Laravel - Medium by Jeff Simons Decena
- Practical Php Testing is here Siorgio Sironi (2009) - although an old book, it is still a good guide to testing.. Only 61 page PDF.
- VS Code
- Extension: Better PHPUnit (video)
- Configure CTRL + T to run tests, CTRL SHIFT + T to rerun
- Extension: Better PHPUnit (video)
- PHPUnit (doc 8.0)
- Recommended to install per project:
composer require --dev phpunit/phpunit ^|version|
- e.g.
composer require --dev phpunit/phpunit ^8
- Included with dev dependencies on the laravel framework.
- Install globally, configure phpunit.bat and add to path (not recommended but useful for running from the command line).
- Recommended to install per project:
Over the years I have come to describe Test Driven Development in terms of three simple rules. They are:
- You are not allowed to write any production code unless it is to make a failing unit test pass.
- You are not allowed to write any more of a unit test than is sufficient to fail; and compilation failures are failures.
- You are not allowed to write any more production code than is sufficient to pass the one failing unit test.
Uncle Bob's full article: Source
- An introduction to Test-Driven Development (TDD) - This is a representation of a complete application at a different points in TDD.
- Starting code for the GildedRose Refactoring Kata
- Tennis Refactoring Kata
- SupermarketReceipt Refactoring Kata
- Theatrical Players Refactoring-Kata - Includes the first chapter for Refactoring by Martin Fowler.
- Yatzy Refactoring Kata
- Use Adam Wathan's Test Driven Laravel from Scratch video above as a guide and practice this method.
- October CMS - Based on Laravel, on setup there is a full set of tests to run. (Runtime ~10 min - with xdebug on), turn xdebug off if not generating reports
- October has been installed and run, examine the tests in more detail, what are they testing, etc.
- Laravel Boilerplate - Tests take 10 min to run (with xdebug on), turn xdebug off if not generating reports
- Laravel Boilerplate has been installed and run, examine the tests in more detail, what are they testing, etc.
Notes are still ongoing and may not necessarily make sense out of context.
- TDD, when used correctly are good.
- Documentation can be created from well named tests.
- Test behaviour not implementations.
- Testing is an art, there isn't a right way for everything.
- Testing takes practice
- Try to use real objects rather than mock data.
- Tests should be trustworthy.
- Anna Filina (Recap)
- Write a test to prove what is being tested works.
- Write tests when you see a bug
- Write test when you improve code
- Write tests as you write new code
- Write tests before you write code
- Text unexpected scenarios
- Testing = Pre-emptive Debugging
- Google
- Small - like unit testing
- Medium
- Large - acceptance testing
- Mocking can cause dependencies or coupling.
- Ensure that both success and failure cases are covered by appropriate unit tests
- There's a lot of value in reading books on good coding and design practices even if they don't focus on unit testing
- TDD is recommended for any long lasting project which may need new features in the future.
The next plan from TDD was Learning Plan for Design Patterns and Principles of Good Design
Copyright (c) 2019 Pen-Y-Fan
Permission is hereby granted, free of charge, to any person obtaining a copy of this learning plan and associated documentation files (the "Plan"), to deal in the Plan without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Plan, and to permit persons to whom the Plan is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Plan.
Content copied from Wikipedia.org is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply.
Great info!