Service Virtualization

 View Only
  • 1.  HTTP-Response-code

    Posted Jan 06, 2023 01:52 PM
    Good afternoon,
    How can a value be set in http-response-code on the workstation?


  • 2.  RE: HTTP-Response-code

    Broadcom Employee
    Posted Jan 06, 2023 02:21 PM
    Hi Wadson,

    What you mean by set a value in http-response-code on the Workstation? Can you provide more information?

    Prema


  • 3.  RE: HTTP-Response-code

    Posted Jan 07, 2023 10:22 AM
    Good afternoon Premalatha,

    I need to generate a random number from 0 to 500. According to the result of the generated random number, the http-response-code is displayed.
    Example:
    If random_number < 100 http-response-code = 200
    if random_number >100 and <200 displays http-response-code = 404
    If random_number > 200 and <500 displays http_response-code = 500


  • 4.  RE: HTTP-Response-code

    Broadcom Employee
    Posted Jan 09, 2023 12:13 PM
    Hi Wadson,
    You can follow the below steps:
    . Use Random Code Generator Data Set to generate a random number between 0-500.
    . Use Scripted Assertion and write the code to build your logic to set the http-response-code to a property.
    . Use the property in your Response-->Meta Data.

    Hope the information helps. 

    Regards,
    Prema