Using tests to stamp out my ideas into functional code has worked well for me. Sometimes I use TDD (Test Driven Development) sometimes I take more of a BDD (Behaviour Driven Development) approach.
I am not going into much detail on test driven development here, there are already great resources for that online. To quickly summarise, TDD is a software development practice where you write a test/behaviour before the code that will make them pass. Once the test passes you clean up the code and start with the next test. Also known as the Red Green Refactor cycle.
To be honest, I used to think TDD was just a good idea in theory, but never had enough time to really use it on my work projects as there were always pressures of deadlines and tight budgets. I slowly began to use TDD on my side projects using tools that continuously watched my test and ran them in the terminal watching for test failures. Then I discovered Wallaby.js, a tool that allowed me to see my test fail in real time.
I use Visual Studio Code as my editor with the Wallaby extension installed. Real time in-line test feedback is shown directly in the IDE.
What I also find very useful is the instant feedback on any console logs to inspect the object right there in the editor.
When opening the code being tested, you can quickly see the affected lines that have failed tests.
This tool has made writing my test so easy and fun and I honestly can not think of working without it.
I don't normally spend money on dev tools. But this is one purchase that's not too hard to justify when you discover how productive you can work with it. They do have a free trial that you can use to kick the tires.
After digging around I found a similar tool for the .net world called NCrunch.
I'm hoping to see more of these type of tooling in the future which can ultimately make testing a first-class citizen in the IDE.
Top comments (2)
Thanks a lot. Do you have any suggestions for PHP Developers?
Sorry not that I am aware of. Just know of the test tools in PHPStorm and the watcher you can run in the console github.com/spatie/phpunit-watcher