Make Testing Easier
In the last lesson, I’ve identified what the issue is, which is that a pig thinks it’s still in the field when it’s actually not part of
field.animals anymore, which only occurs when I try to move an animal that already has a location into a location that is full. Kind of subtle.
00:19 We can go ahead and fix that, but to fix that, I want to be able to run my tests a little more often. So I’ll take a small step towards automated testing by just adding the code that I’ve played around with in the interactive shell at the bottom of the script so that it just runs every time that I run the script.
pig should still be in there. Okay, so this is not great automated testing at all. All I did was add a bit of code at the bottom of my script, and there’s lots of better ways of doing this, but I want to keep it simple here and just avoid that I have to enter these instances and re-create them every time until I fix this bug. Okay, so next step is to actually fix the bug.
Become a Member to join the conversation.