Dec 14, 2016

Tips to write immortal test cases

1 : Do not test internal implementation just check out side functionality

Eg : 
Function add(a , b){
Var c = a + b + 'hello';
}
So you  should not test what value is assigned to c or a or b inside add function.
You only have to see what input you give and what output you get from add function


2 : Write testable code that includes callbacks if Possible

3 : Review your test case from other person who does not know what are you testing and should be able to figure out what test you have written.
Because there will be time when there will be 1000 thousands of test cases and even you won't be able to figure out which one does what.

4 : Create a habit of writing test case before writing code as this will be time when you will be including callbacks if that code has completed its task...refer to point no 2

5 : Automate your test cases and run them daily, let them fail you don't need to worry , those failures indicate incomplete or buggy code that's scattered all over your app

6 : Discover couple of debugging environments for testing your test case not just one way...

7 : find the easiest way to run test cases. It should not be couple of steps to run test case. It should be one liner, small configuration, one simple button.

8 : it's like if test cases are hard to run then no body other than you will run test cases

9: even if there are couple of steps to run test cases then try to configure those couple of steps in one liner .

10 : Learn to differentiate between unit and integration test. Many people write Integration tests thinking they are writing unit test case.People faiI to recognize the boundary of unit test and pull that unit test toward integration test .

11 :  how Integration testing will help

No comments :

Post a Comment