I realised that when I was adding tests to my project after the code was complete, there is a tendency to not thoroughly test every module of code. This arises from it being a pain in the ass to have to spend a lot of time writing tests on code that appears to work OK anyway.
I am sure that many other developers have the same experience where they can show their manager that they wrote a test for a feature and the test passes.
But with different inputs, the code may produce incorrect results. So this leads me to be in favour of writing tests at the same time as developing the code modules/classes. You could also do TDD (Test Driven Development), but I am thinking more about testing the code that you just wrote while it is fresh in your mind and you are most aware of how it is supposed to work.
The same probably applies to documentation where it's relatively easy to write comprehensive documentation for each Class as it is created rather than leave it till the end of the project. I try to write short Classes of self-documenting code rather than having Documentation headers, so it is more important to do this with my way of working.
Have to keep this in mind for future work.