-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmulti_configuration.groovy
34 lines (32 loc) · 1.64 KB
/
multi_configuration.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**
* This example shows how to use the same configuration file to generate two
* files with different columns!
* This allows you to generate a set of related files with one configuration.
*
* java -jar zefaker.jar -f=multi_configuration.groovy -output=dummy
*/
// number of rows to create in the first file
maxRows = 10
// the name of the first file to output
outputFile = "companies.xlsx"
// column configuration for the first file
generateFrom([
(column(index= 0, name="Account No.")): { faker -> faker.number().numberBetween(1, 200) },
(column(index= 1, name="Company Name")): { faker -> faker.name.fullName() + faker.options().option("Plc", "Pvt Ltd", "") },
(column(index= 2, name="TPIN")): { faker -> "TPIN" + faker.number().numberBetween(1, 200) },
(column(index= 3, name="Registration Date")): { faker -> "1970-01-01" },
(column(index= 4, name="Postal Address")): { faker -> "P.O. Box 123" },
(column(index= 5, name="Telephone")): { faker -> "265999" + faker.number().numberBetween(111111, 999999) }
])
// number of rows to create in the second file
maxRows = 10
// the name of the second file to output
outputFile = "directors.xlsx"
// column configuration for the second file
generateFrom([
(column(index= 3, name="Company Account No.")): { faker -> faker.number().numberBetween(1, 200) },
(column(index= 0, name="Full name")): { faker -> faker.name.fullName() },
(column(index= 1, name="Phone Number")): { faker -> "265999" + faker.number().numberBetween(111111, 999999) },
(column(index= 2, name="E-mail")): { faker -> "[email protected]" },
(column(index= 4, name="Address")): { faker -> "P.O. Box 123" }
])