Write an article based on this summary:

Write the test before you write the code. Come up with unit tests as you write code, if you need to. Write testable code.
It might seem counterintuitive, but developers swear that the way to go is to write code to pass a unit test, rather than using unit tests to see if code will work. This can be the approach to take if you haven’t actually begun to write your code, or if you don’t have much yet. Be goal-oriented: write your unit tests to check if code will do what is expected, then write the code, then test it. Writing the tests first encourages you to write just enough code to make the program do what it needs to, without inadvertently including unnecessary or bad code. If you’re well on your way with the writing of your program, you can still make use of unit tests. Just draw on the map you made of your program to break it down into individual units. Run the tests using the AAA approach, and adjust your code as needed based on the test results. One of the hardest things about using the unit test approach in program development is that you must plan carefully to have code that can actually be tested. If your program is full of elements that you can’t actually test, then you won’t be able to use the unit test method to verify that your program will work as expected. Keep this in mind as you write code for your program. For example, avoid things like hidden inputs and non-deterministic factors in your program’s code.