Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

abap unit test class method call sequence determination

Former Member
0 Likes
764

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

2 REPLIES 2
Read only

uwe_schieferstein
Active Contributor
0 Likes
392

Hello Anubhav

If the methods to be tested require completely different setups then you have to create different test classes.

Regards

Uwe

Read only

former_member183804
Active Contributor
0 Likes
392

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