I’d never really cared about testing until I realized that I should consider every new piece of code and feature full of bugs and broken till I tested it
So when you write new code/features it might be easy to just build app with new stuff, run to check if it crashes and that’s it. Or just test one kind of use case and don’t test other, thinking it will be fine
I did this mistake so many times that I realized I need to change my approach and decided to share it. It’s really hard to do things right the first time, it might seem like things work out pretty fast, but have you ever remembered things working totally how they should from the first build?
Or imagine writing code for 6 hours straight and then just building and getting totally working stuff? Never happened to me! It’s always small piece by piece, verifying each step working, debugging and fixing
Consider It Broken
So here’s the mindset I think everybody should have towards their newly written code – it’s broken and your app will crash or won’t work until you’ve tested every possible use case. And even after that
Because in most cases it’s true. The only way of you writing bug free code for hours is by you having written it before many times. What you’ve written before several times – you probably know pretty good and it should work fine without testing. But what are you doing then writing same kind of stuff instead of learning new?
Acknowledging your code to be broken puts you into healthy cautious state. It’s like being scared to look under the bed to see if there’s a monster or going to dentist to learn that you have bad teeth. Better to just don’t do it and think everything is fine. Luckily, never happened to me
Ways To Test
Coming from there you can choose any kind of testing you want. Automated/not etc. Eventually you still need to keep in mind all possible paths, whether you automate testing or do manually. You can learn some stuff about Espresso UI tests here,pretty easy to make them
And of course it all makes no sense til you get to experience yourself. Code is full of bugs – whether you want to acknowledge it or not, testing is important