Friday 22 June 2018

Data Generation using Java

Data Generation in Test Automation is one of the tedious task which consumes lot of time before the start of execution. So, Why provide the data required for Automation manually? Automate it. !!

Having said that, it is not so easy to address every requirement with single solution. In the below example, i am trying to address few of the generic use cases which will let us automate the data creation. 

NOTE: 

  • Below sample uses 'Xegeran automation library to generate text from regular expressions.
  • Apache commons RandomStringUtils class to generate the random text.


Below example will let you know the way to generate the Random strings of different types.


public class RandomTextGenerator {