Search code examples
angularjsapitestingautomated-testsdummy-data

Not able to use the another field value in random function


I am generating the data from the Mockaroo - Random data generator

Scenario is :

I have one field Income (value can be 0 to 99999) and I have another field Net Income i want value of this field must be less then Income

So, any one can suggest me formula or regular expression for this Which support in Mockaroo.But thing that i can not use the static formula like Income - 10 or something like this


Solution

  • Actually the field coming to the random function they were considering them as String so i need to cast them.

    To Cast to integer formula is : .to_i

    So, solution for this is in mockaroo is

    Select Regular expression then write in field : {{Income}}

    Then select the fx and write the condition : if true then {{this}}-random(0,Income.to_i) end

    if anybody has doubt just do the comment i will reply you soon