Before is better. You might know what the right results look like but not how to get at them. Plus there’s no writer’s block with TDD.
After it becomes a chore, maybe even a waste of time, e.g., if the test fails because there’s something wrong with the test itself, not the source.