3 ms·
unit testing is essential, TDD might be a stretch in practice. instead of having separate test/ directory with multiple unit test files, I put unit test code r
by synergy20 5y ago
unit testing is essential, TDD might be a stretch in practice.
instead of having separate test/ directory with multiple unit test files, I put unit test code right in the source code(at the end of the file), so when I modify the source I can easily update the unit test in the same place, and they never get out of sync. It worked for me very well. They can be turned on/off easily too. Sometimes it's easier to understand the code by reading the unit tests than reading the whole lengthy code, and it's helpful when they're in the same place. For me, unit test code is part of the real code, not something 'additional'.