Generate random data

Documentation

 

Writing out the input data by hand is tedious, and violates the moral code of the efficient tester: let the machine do the work!. To automate this BlueDuck SDA comes with a set of data generators for some basic data.

Example

Generate random data

 

Including SDA Core

#include <../../lib/sda.core.au3>
						

Get a new Test object instance

Func TestDataGenerator()
	Local $TestOne
	Local $TestData

	;New Test
	$TestOne = NewTest("TestDataGenerator")
	;Test Settings
	$TestOne.ScreenCapture = False
	;Start Test
	$TestOne.Setup()
	;Test Report
	$TestOne.Report.Create						
						

Get a new Random data object instance

	;Data generator
	$TestData = $TestOne.NewDataGenerator()
	$TestOne.AddStepResult("Random Name",$TestData.Name,1)
	$TestOne.AddStepResult("Random City",$TestData.City,1)
	$TestOne.AddStepResult("Random Country",$TestData.Country,1)
	$TestOne.AddStepResult("Random ValidEmail",$TestData.ValidEmail,1)
	$TestOne.AddStepResult("Random inValidEmail",$TestData.InValidEmail,1)
	$TestOne.AddStepResult("Random Alphanumeric",$TestData.Alphanumeric,1)
	$TestOne.AddStepResult("Random Number",$TestData.Number,1)						
						

Close Test

	$TestOne.Report.Close
EndFunc						
						

Run Test

TestDataGenerator()						
						

Test result


Data Generator Object

Generate random data

 
Method Description Parameters
Number Generates a pseudo-random float-type number
  • Min [optional] The smallest number to be generated. The default is 0.
  • Max [optional] The largest number to be generated. The default is 1.
  • Flag [optional] If this is set to 1 then an integer result will be returned. Default is a floating point number.
Alphanumeric Generates a pseudo-random alphanumeric
  • iStringLong [optional] String long. The default is 10.
Country Generates a random Country
City Generates a random City
Name This data type randomly generates human names.
ValidEmail Generates a random valid email address according to RFC 2822
inValidEmail Generates a random invalid email address according to RFC 2822