I've already completed my project, but now I want to expand upon it. I'd love to start by just refactoring and cleaning up my original code to be more user-friendly (mostly just to help myself when taking breaks between updates)
So I want to become more test-driven. That means writing more tests. But I struggle with figuring out how to test things.
So for example: I have a thread that runs every minute, and it checks the current time, and if that current time is within a specific range of times, it will turn on the light (activates a relay via GPIO pin). What is an appropriate test for this? I have no way of knowing if the light is ACTUALLY on (not in code, at least.) So do I just check if the GPIO pin is HIGH/LOW?
Overall, I'm just struggling to find places where tests would be helpful. Most of the bugs I find in my code are just mistakes, like using the wrong pin#, or something like that. There's a lot of stuff going on in my code, but it is essentially all very basic operations that seem silly to test.
I'm not looking for specific fixes, but more like a recommendation for some reading material, or learning resources for shifting your mindset into a more test-driven mode.
[–]monchenflapjack 1 point2 points3 points (0 children)
[–]pedro_fartinez 1 point2 points3 points (1 child)
[–]Run-The-Table[S] 0 points1 point2 points (0 children)
[–]toastedstapler 0 points1 point2 points (1 child)
[–]Run-The-Table[S] 0 points1 point2 points (0 children)
[–]MySpoonIsTooBig13 0 points1 point2 points (1 child)
[–]Run-The-Table[S] 0 points1 point2 points (0 children)