‎2008 Jan 03 10:59 AM
Hi,
I have a class that has methods in my test class
setup
test_add
test_delete
teardown
the call sequence is
1. setup , test_add , teardown
2. setup , test_delete , teardown.
I wanna know how to find inside the setup() method which method was called last and which method will be called next. I wanna do it to prepare diff set of data in setup() method
for different test methods.
Please suggest solutions and pointers.
regards
anubhav
‎2008 Jan 03 11:14 AM
Hello Anubhav
If the methods to be tested require completely different setups then you have to create different test classes.
Regards
Uwe
‎2008 Jan 04 10:26 AM
Hello Anubhav,
the setup() method is intended to initialize a fixture common to all test methods. To differ (rely) on the test progress so far and have a conditional logic is no good idea. These will make the code complex and thus hard to understand. Additionaly it introduces the risk that test methods depend on each other.
To split different test methods according to a common fixture to a common test class as Uwe suggested is one possibilty. Alternatively do a individual initaliziation within the test methods or delegate to some ordinary service method.
Happy New Year
Klaus