Forum Discussion

punekar's avatar
punekar
Occasional Contributor
14 years ago

Getting name of sub-task of a complex task

Say I have a complex task, say "Complex-T" which has three subtasks "TaskA", "TaskB" and "TaskC". And I have a LoadTest that contains the Complex-T task.


I have written an event handler to process OnLoadTestingRequest for one of the requests originating from a subtask, say "TaskB". 


Now in the script, when I check the User.TaskName property, it points to "Complex-T". How do I get the name of the subtask "TaskB" ?

5 Replies


  • Hi Suresh,





    There is no direct way to do this at the moment. I have registered this as a suggestion in our database. Thank you.
  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi David,



    Could you please notch up as I seem to have the same problem as Suresh do ?



    Thanks.
  • Pawel_1's avatar
    Pawel_1
    Occasional Contributor
    I also have a question about LoadTesting and Complex Tasks. Are there any samples available, or is it at all possible to modify the data through scripting in a complex task. For example:



    I have a Complex Task called 'ComplexTask1' which contains four HTTP Tasks, 'Login', 'Search for Product', 'Add Product', 'Logout'. I want to run the 'Add Product' HTTP Task multiple times for each single run of the complex task. How would I go about adding data from from an excel sheet into the HTTP Tasks. I've been able to do this for single HTTP Tasks, but reading this thread, if I cannot obtain the name of the subtask in a complex task I'm not sure if this would be possible?
  • Hi Pawel,



    At the moment, there is no easy way to get this information. However, this is still possible.
    Assume that you have two tasks (with N and M requests) in your complex task. The first task has count 1 and the second task has count 3. You need to handle a request of the second iteration of the second task. To do this, you need to calculate the global id of the request and check this id in your event handler. Global ids are spread in this way:




    from 0 to N-1 - the first task


    from N to N+M-1 - the first iteration of the second task


    from N+M to N+2*M-1 - the second iteration of the second task


    from N+2*M to N+3*M-1 - the second iteration of the second task




    So, if you want to handle a request of the second iteration of the second task, you need to check whether its id lies within the [N+M, N+2*M-1] interval.