Soft question: testing process?

My approach to testing might be relevant if you're doing a fair amount of "fun" programming. I usually write tests for functions that I can't immediately use to see if they're working, and functions that are a bit subtle, even in fun programming. This actually increases the "fun factor" because it lets me get relatively quick feedback on my work. But for fun coding, I never tell myself that I need to write tests... which could decrease the fun.

I certainly would never mock on a fun project (okay I may someday prove myself wrong on this), and seldom have a separate file or module for tests, since I don't accumulate that many tests. Eventually I may move them, but it's often nice to have the tests right there next to the functions themselves.

1 Like

This points towards an important point: software can (and should) be designed to facilitate testing. Mocking out the time is a great example of being able to control external factors from the test code.

Dependency injection is the general pattern of letting software depend on explicit dependencies which are passed in as a parameter, instead of being hard-coded constants. In my experience, it works well when employed consistently across a large code base.

Can you elaborate a bit? What is happening that is slowing down development time? Bugs in insufficiently tested software? Something else?

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.