re: When do you write your tests? VIEW POST

VIEW FULL DISCUSSION
 

Long before I ever heard of the concept of testing, I had the habit of modifying my main() to check whatever code I'm working on. This was not "formal" testing - I was just running the the function I was working on and printing the results - but I was writing code that runs my code in various scenarios to see how it acts.

Nowadays I'm trying - as much as I can - to integrate this workflow into the proper testing. I'm already writing code that "tests" my code, so I just need to write it in a test function instead of in main(), and after I see that the results are correct I'm changing the test from printing them to verifying them with assertions.

code of conduct - report abuse