0

i have the following request, and i need to get ticketId from body. Can anybody help me please ?

web_custom_request("loadMessage.json", 
        "URL=http://someURL/loadMessage.json", 
        "Method=POST", 
        "Resource=1", 
        "Referer=http://someURL/096F516B149EFF0F48DD2D12B8AF2577.cache.html", 
        "Snapshot=t14.inf", 
        "EncType=application/json; charset=UTF-8", 
        "Body={\"ticketId\":\"440684\", \"ticketThread\":\"SERVICE_CREATION\", \"locale\":\"en\"}", 
        LAST);

Thanks in advance!

Vardges
  • 197
  • 3
  • 8
  • 21

1 Answers1

1

You appear to have a conceptual issue in play here with how HTTP and how LoadRunner works with HTTP virtual users. The data you are looking for is being passed back as a part of the web_custom_request(). You actually need to capture the value from the response body of a previous request. This process of capturing the data from a previous request and replacing the hardcoded value in the current request with the captured one is termed "correlation." A full 1/3 of the standard web virtual user training class from HP is devosted to this subject, with several techniques covered to handle the dynamic data. Here is a technique which is fool-proof:

  1. Record your business process twice
  2. Use a tool to find the differences in the requests. These will come down to a few items related to session, state, time and business process data. Your ticket ID is in the business process data category, but it is most likely not the only item which needs to be addressed.
  3. Once you have identified the correlation candidates, look in the generation log to find the first example of the piece of data in question. In the case of your ticket ID I would be searching the logs for 440684.
  4. This response body is tied to a request. If you take a look at the information surrounding the response in the script generation log you should be able to determine which request in your script generated the response which contains the response body.
  5. Using standard techniques involving the use of web_reg_...() functions, capture the response for your use into what is termed a correlated variable
  6. Replace your static value for the response collected into your web_custom_request()

If your manaagement has not provided you with training and a mentor in this role you should consider whether they are interested in your success or only in your ability to bill. This pattern of no-training or professional development is oft repeated and typically results in a manager sacrificing a performance tester to an unhappy customer without the manager accepting any shared responsibility for what has happened when it is the decisions of the management team which have been primarily responsible for what happened. If you have found yourself in such a situation I would recommend finding a fast exit strategy for it is almost certain that you will have to payt a price for someone else's decisions related to your training and professional development.

Andrew Barber
  • 39,603
  • 20
  • 94
  • 123
James Pulley
  • 5,606
  • 1
  • 14
  • 14
  • The problem is that application uses GWT, and there are no any pages where can i get ticketId. So, when pushing the button, id generated automatically, and i could't find the way to get id from response. – Vardges Oct 30 '12 at 12:30
  • Then take ther javascript function and convert the code to C. Run the C function before your call and take the output to insert it into your script. Because Ticket ID's likely need to have universal uniqueness the likelihood is low that a single workstation could generate a six digit numeric distinct ID which does not conflict at some point with another already existent Ticket ID. Most likely these ID's are in sequence and a reservation is generated earlier in the script, but is only visible or locked when you see it. Take a look at your load generation logs for the ticket ID value. – James Pulley Oct 30 '12 at 13:38