Getting started with Unit Testing #2: Don't get stuck!
As a beginner tester you might find yourself off to a great start, testing is going great and you think you’ve got the hang of it and then from nowhere, you get stuck on a test that you can’t figure out.
It might be your implementation code that’s too complicated or coupled and needs to be rewritten (read my other post on why you should always start fresh: GETTING STARTED WITH UNIT TESTING #1: START FRESH!).
It might be you can't figure out the mocking needed or for some other unknown reason your output is just not what you are expecting. It’s easy to go insane over these kind of tests, trust me I’ve spent days figuring out a certain test.
But if you're a beginner you might potentially feel so stuck that you’ll give up Unit Testing all together. You might think to yourself:
-“Well if I can’t figure out this thing then think of all the other things I won’t be able to figure out.”
Ignore it!
You have to respect the fact that you are still learning and it’s ok to leave a test if its to hard. You can always come back to it later!
A tip is instead of removing what you’ve written so far or comment it out, ignore it (or skip depending on which test framework you are using).
By adding the ignore attribute on a test it wont run but you’ll always see it in your Test Explorer as a reminder to come back to it.
You can also add a little Ignore message with why you got stuck and a heads up to your co-workers that you intend to come back to this once you get a bit more experienced.
I promise you, leave it and come back a 1-2 weeks later when you’ve done some more testing and maybe some reading (I recommend reading: STARTING TO UNIT TEST: NOT AS HARD AS YOU THINK). This test you got stuck on is going to be so much easier to figure out.
Hang in there and don't get stuck!
Cheers friends! ❤️