Scripting: How to write to datasource?
I'm sure it must be possible to write to a Writeable Datasource from a script. I just haven't figured out how to do it.
This is my script:
import com.parasoft.api.* String setRequestId(ScriptingContext context) { String orderId = '023' + new Date().format('yyyyMMdd') int productId = Math.abs(new Random().nextInt() % 999999999) String requestId = orderId + '00' + productId return requestId }
How do I write requestId out to a data source?
Thanks!
Comments
-
I'm sure it must be possible to write to a Writeable Datasource from a script. I just haven't figured out how to do it.
There is no public API to do this. You must use a Data Bank. However, you can chain a Data Bank to an Extension Tool if you need a script to return the document needed as input to the Data Bank.
0 -
Please also be aware that SOAtest 9.10.2 and later has a Data Generator tool. It acts very much like a Data Bank except can auto generate values (no scripting required). I think this is a better fit for what you are trying to do.
1 -
Hello People, Im new to parasoft tool, can anyone please tell me why do we use writeable datasource in a script testing.
0 -
Writeable data sources are used when you need to capture data from one test that should be iterated over in a subsequent test.
0