How To Test Your Code ?

Testing is must have for any kind of code written by us to ensure that it works well. Testing builds code confidence and adds reliability to the software developed by us. In this post, we will discuss the very basic flow of testing to ensure that our code works without any known bug.







Step 1: Start testing the code and check whether it's working fine. In case it does not work as intended, it means we found bugs. It's a general assumption that a software cannot be free of bugs, hence bugs will always be there whether it's functional or cosmetic.







Step 2: In case a bug is identified, it must be fixed and re-tested to make sure that it's gone. In most of the cases, we only fix one flow whereas there might be other flows which fail for the same scenario. If time permits, we must also test other flows.







Step 3: Didn't find any Bug? Don't worry. We can follow a different approach to test the same code which might reveal more bugs.







Step 4: We can leave a cosmetic bug, but it's always good to fix it for better reliability.







Step 5: At last, we can stop testing if all the possible flows are well tested.







The same cycle can be repeated when we update the code or add additional features to previously tested code.