Differences

This shows you the differences between two versions of the page.

Link to this comparison view

dynamicfielddomain [2016/09/22 02:35] (current)
Line 1: Line 1:
 +===== Dynamic Field Domains Using MScript =====
 +
 +In //​DataDesigner//,​ you can specify a list of domain values for each field. ​ The domain values are usually constant or static text. For example:
 +   ​UserRole:​ Normal, Super, Admin
 +   Age: 5, 10, 25, 45, 60
 +   ​FirstName:​ John, Bruce, Teri, Sandy
 +
 +There are times when you generate the test data set you may wish to randomly generate these values or write your own function to generate these values according to your own rule or convention.
 +
 +----
 +==== Dynamic Data ====
 +
 +//​DataDesigner//​ provides a facility to allow you to call //MScript// functions or write your own //MScript// functions to dynamically generate domain values for the field.
 +
 +For example:
 +   Age: $rand(5), $rand(6, 16), $rand(17, 35), $rand(36, 60), $rand(61, 120) 
 +
 +The above example calls //$rand()// //MScript// function to generate a random number in the specified range when the test data set is generated. ​ Each time when the test data set is re-generated,​ a different set of domain values are generated.
 +
 +----
 +==== Custom MScript ====
 +
 +You may write custom //MScript// functions and call them just like //MScript// function example above. First you must add your //MScript// implementation java class to the field //MSript Class//​. ​ Once that's declared, you can use them as follows assuming your //MScript Class// contains the java function //​ageByGroup('​group'​)//:​
 +   Age: $_ageByGroup('​kid'​),​ $_ageByGroup('​teen'​),​ $_ageByGroup('​youngAdult'​),​ $_ageByGroup('​midAge'​),​ $_ageByGroup('​senior'​)
 +   
 +
  
Print/export
QR Code
QR Code dynamicfielddomain (generated for current page)