If I write test code to test my code, the test code might have bugs so it needs to be tested and when my code changes my test code may have to change. Repeat ad infinitum.
How is this problem solved (in practice and in theory)?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The test tests the code, and the code tests the test.
When you write a test, then write enough code to run it, the test fails. Then you write the code to make it pass. If it doesn’t go this way – if it passes before you write the code, or if it fails after, something’s gone wrong. If the test passes before the code is written, obviously there’s something wrong with the test – fix it, until you’ve got red and got the failure you expected. If the test was red and doesn’t go green after writing the code, then one of two things is wrong: the test, or the code. Figure it out, fix it, and move ahead.