how to proceed writing test cases? am new to it!!
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Manu_Sharma
Posted On:   Monday, February 19, 2007 08:16 AM

please give me some links to understand how shall i write test case? i am a newbie... dont hve idea at all about it..

Re: how to proceed writing test cases? am new to it!!

Posted By:   Christopher_Koenigsberg  
Posted On:   Monday, February 19, 2007 11:54 AM

It's kind of a surprising thing, I guess, but basically the idea is that you have to think, yourself, of all the things that might go wrong, or might go right, from your methods, and you have to write them all up as test cases.



Because you're the one who thought of how the methods SHOULD work, so you're the only one who can really write the test cases for that...... i.e. what if you made a mistake in your methods and they don't do what you intended, but someone else writes a test case for them, thinking they are working correctly..... then the tests will come out OK but your original intentions will not be satisfied...



A big problem is that it takes a long time, and is hard, to really thoroughly test everything about your code, especially as it grows bigger and bigger.



And, if you're on a project with any kind of time constraints, management etc. (i.e. the real world :-) they usually won't budget/allow any time for this..... unless you can fold it in quickly and very early on, so that it pays for itself soon and therefore becomes 'grandfathered' in to the rest of the project....



I remember a funny time when we were trying to introduce JUnit and test-first design to a project, and we presented it to a boss who was gung ho at first, until he realized, wait a minute, it doesn't help you write any of the tests? you have to figure out all the tests yourself? then what good is it? .......



And by the way, the same boss had actually been writing tests for his own code all along, in the form of "main" harnesses/wrapper applications, so really JUnit would just be another way, maybe a little more easy and encouraging, to hook up and exercise his same tests that he had been writing anyway....




the point is, the JUnit tool itself (and derivatives, addons, etc.) are just infrastructure support (a ladder, a paintbrush, etc.), for you, but you have to be the one (the painter, the mural designer, etc.), if you come up with designs, to write the tests for your designs.... preferably even before you write the code to implement those designs, but again in the real world on existing projects, that's often not possible, not yet (at least in the real world I've been working in for the last 30 years.... of course maybe it is time to find a new job anyway :-) .....
About | Sitemap | Contact