Virtual service think time based on incoming request

book

Article ID: 211362

calendar_today

Updated On:

Products

CA Application Test

Issue/Introduction

We have requirement to have think time on virtual service on every 10th request.

Could you please provide some documentation or example code to Implement this case. 

Environment

Release : 10.6

Component : CA Service Virtualization

Resolution

To find out every 10th transaction, add a counter variable and increase that value for each request by adding a custom logic in scriptable data protocol.

    Add a "Java script" step between "VS Image Response Selection" and "HTTP/S Respond" step and add the logic to verify whether counter is multiple of 10. If yes, then use Thread.sleep(10*1000); (Which will keep the thread in wait state for 10 seconds).