Hello,
You should be able to use the DataGen TestStep for this. Create a DataGen TestStep in your TestCase, and add a Property to it with the Script type. Set the Mode to STEP and make sure it's set to Shared. Use the following Script:
def useContext = context.LoadTestContext ?: context
useContext.myid ?: ( useContext.myid = Math.random() )
Basically, it will get either the LoadTestRunContext if you're running a LoadTest, or the regular TestRunContext if you're running a TestCase. It will then check if the context has a "myid" variable, and either return it, or generate a new value and set and return that. You can of course replace Math.random() with some other function to generate a more suitable identifier:
def generateId() {
//Generate and return a unique ID.
}
def useContext = context.LoadTestContext ?: context
useContext.myid ?: ( useContext.myid = generateId() )
Hope this helps!
Regards,
Dain
eviware.com