Clarification on Pre, Post nodes - Unit Testing
How to use themHi,
I am unable to completely understand the Pre, Post and the OutCome Conditions in .TEST -Unit Testing
I have a method which does not take any parameters nor return any parameters.
The method when called , uses a public variable and performs some manipulations to the variable
so that the value of the public variable is changed inside this method.
Now What is the PreCondition, PostCondition and the OutCome in this case ?
I know that the Outcome is the final return of the method, that is whether the method has executed in sucess or with some exception ?
I was also able to check the PostCondition, Which is the final value of the public variable after the execution of the method.
But i am unable to check the PreCondition value.
the declaration of the public variable is done like this:
public int var1 = 10;
If i keep the value of Var1 in PreCondition as 0 (Zero) ,
does it mean that the variable Var1 should have the value Zero during the call of the method ?
If so keeping any value (-10 , 0 , 1000 .......) to the value of Var1 in the PreCondition does not give
a " Failed" result for the test case (Scenario).
That is :
I am unable to get the "Fail " resultant on a PreConditon variable value in the TestCase.
Please help me, with an example code if possible :-)
and Sorry for the lengthy post.