Forum Discussion

shashank4u's avatar
shashank4u
Regular Visitor
9 years ago

In ServiceV, How to Access the data generator in datasources via groovy scripting.

Hi There,

 

I have been using the READY API tool 1.3.1 for Service Virtualization.

 

I'm using serviceV for mocking a service.

 

In my mock service I need a random number to be generated and used in my mockresponse also I need the same random generated number to be pushed into a CSV file along with other attributes that I will fetch from the database.

 

To get the random number I 

 

1. Created a data generator datGen.

2. Created a property randInt and selected the propertytype(Integer), Generation Mode(Random), Minimumvalue(1), MaximumValue(100000).

 

I'm able to directly insert the property value into the Mock Response by going to the corresponding element node and right clicking and selecting Get Data --> VirtResponse[Response_name] --> Property[randInt]. By doing this I'm able to select the randominteger from the data generator into the response, But I also need the value into a variable so that I can use it in a CSV File.

 

So can you Please help me in accessing the data generator property via Groovy scripting so that I can use the value to push into my files.

 

Appreciate your help.

 

Thanks

 

 

 

No RepliesBe the first to reply