Hello All,
I am new to
Junit and have been reading up on the tutorials I understand that junit creates a instance of the testcase class each time it wants to execute testXXX() method, I was wondering why ?? Why not just create one instance and then execute
1) setUp
2) testXXX
3) teardown
in the above order for each testXXX method ?
and I also I read that it uses a collecting parameter design
pattern to fill in the TestResult object with the
test results, It uses the collecting parameter design pattern to collect the output of the multiple methods it executes, (This is what I have understood from the text I have gone through)
The text I was talking about
The Smalltalk Best Practice Patterns (see Beck, K. Smalltalk Best Practice Patterns, Prentice Hall, 1996) has a pattern that is applicable. It is called Collecting Parameter. It suggests that when you need to collect results over several methods, you should add a parameter to the method and pass an object that will collect the results for you. We create a new object, TestResult, to collect the results of running tests.
Now my question
if each testXXX is executed through a different instance how does it collect the results ??
My questions are inter linked I sort of feel that I am misunderstanding something here !
Thanks in advance