¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: [TDD] How do you write tests if you aren't sure what the result should be?


 

Avi,

I think you are expecting something unrealistic from TDD.

TDDing only facilitates 2 things:
1. Verifying that the code does what the programmer thinks the code should
do.
2. Growing the code in a way that makes the code testable, expressive and
well-factored.

TDD (and unit tests in general) will NOT verify that what the programmer
thinks the code should do actually solves the problem correctly. That is
why we have customers, customer tests and feedback on frequent deliveries
of working software.

If you do not have any idea how to solve the problem, TDD will not
magically lead you to a solution. If you do have an idea, then TDD will
only help you verify that you implemented YOUR idea faithfully and that the
code is well structured.

------------------------------------------------------------------------------------------

I also agree with what I think that others have said about your specific
problem: The engine should be responsible for this functionality, not some
independently developed code. The engine should be able to "predict" what
is would do by running its own functions to simulate what it would do. Why
reinvent the algorithms that the engine already implements? Even if a
faster, less accurate prediction is required than simulating the full
engine algorithm, the engine code and its developers will have a much
better start on seeing what can be left out and still return a good enough
estimation.

Steven Gordon

Join [email protected] to automatically receive all group messages.