title: zendata config syntax desc: # File composition # zendata defines the format for each field in YAML file. # YAML file is composed of file description and field definition. # File description # title: A short text to summarize the data type defined by this file. # desc: Detailed text to describe the data type defined in this file, optional. # author: Optional. # version: Version number, optional. # Field list # Field is defined in fields. # A YAML file contains one or more fields. # Field list starts from -field. # A child field can be defined by fields. # Field definition # field: Field name; letters, digits, underlines and dots only. # range: List range; the most important definition. # loop: The number of loops; define how many times a field can loop. # loopfix: The connector for each loop. # format: Support formatted output. # prefix: Prefix of this field. # postfix: Postfix of this field. # length: The length of this field. If separators are not used, specify the field length in bytes. # leftpad: Left-padded characters. If the length is not enough, specify a character. The default is space. # rightpad: Right-padded characters. If the length is not enough, specify a character. # config: Refer to the definition in other file. # from: Refer to a definition file. # use: Use instances defined in the referred file. # select: If refer to an excel table, you can query a field in it. # where: If refer to an excel table, you can use query conditions. # Loop Definition # Define the loop times of a field with a number, e.g. loop:2. # Define the loop times of a field with an interval, e.g. loop:2-10. # range definition # Use commas to connect elements. e.g. range: 1,2,3. # Elements can be a range, e.g. range:1-10, A-Z. # Use colons to define steps, e.g. range:1-10:2. # Steps can be decimals, e.g. range: 1-10:0.1. # Steps can be negative, e.g. range: 9-1:-1 # Intervals can be set as random by R, e.g. range: 1-10:R. Set either random or a specified step. # Use a file to specify a list, e.g. range: list.txt. If the file name is a relative path, it is based on the config file. # Use {n} to repeat a element, e.g. range: user1{100},user2{100}. # Use [], if intervals and elements are repeated, e.g. range: [user1,user2,user3]{100}, [1-100]{10}. author: zentao version: 1.0 fields: - field: field_common # The list type by default. Separated by commas. range: 1-10, 20-25, 27, 29, 30 # 1,2,3...,10,20,21,22...,25,27,29.30 prefix: int_ # Prefix postfix: "\t" # Postfix - field: field_step # Interval steps can be specified. range: 1-10:2, 1-2:0.1,9-1:-1 # 1,3,5,7,9,1, 1.1,1.2...,2,9,8,7,...,1 postfix: "\t" - field: field_random # Use R to specify randomly. Set either R or a specified step. range: 1-10:R # 1,5,8... postfix: "\t" - field: field_loop # Self-loop field. range: a-z # a_b_c | d_e_f | g_h_i loop: 3 # Loop three times. loopfix: _ # The connector for each loop. postfix: "\t" - field: field_repeat # Use {} to define repeated elements. range: u-1{3},[u2,u3]{2},[1-3]{3} # u-1,u-1,u-1,u2,u2,u3,u3,1,1,1,2,2,2,3,3,3 postfix: "\t" - field: field_format # Output as formatted strings. range: 1-10 # passwd 1,passwd 2,passwd 3 ... passwd10。 format: "passwd%02d" postfix: "\t" - field: field_length # Fixed length field. range: 1-99 # 01\t,02\t,03\t..., 99\t length: 3 # the length in Byte including prefix and postfix. leftpad: 0 # Using 0 to pad. postfix: "\t" - field: field_text # Read a list from a file and set it as random. range: users.txt:R # Using the lines of users.txt as range and set it as random. postfix: "\t" - field: field_yaml # use another yaml file's data. range: test/test-nested2.yaml{3} # related path. postfix: "\t" - field: field_use_config # Other definition file can be referred. config: number.yaml # Refer to the definition in number.yaml of the current directory. postfix: "\t" - field: field_use_ranges # Other definition file can be referred, in which more than one ranges are defined. from: zentao.number.v1.yaml # Refer to the ranges in yaml/zentao/number/v1.yaml. use: medium # use medium range. postfix: "\t" - field: field_use_instance # Refer to other definition file which defines multiple instances. from: ip.v1.yaml # Refer to yaml/ip/v1.yaml. use: privateB,privateC # Use the two instances of privateC and privateB defined in this file. postfix: "\t" - field: field_use_excel # Read the data from the data source of excel. from: address.cn.v1.china # Read the sheet named 'china' in data/address/cn.v1.xlsx. select: city # Query the field city. where: cityCode = 852 # Query condition. rand: true # Random for query postfix: "\t" - field: field_with_children # nested fields. fields: - field: child1 range: a-z prefix: part1_ postfix: '|' - field: child2 range: A-Z prefix: part2_ postfix: '|' - field: child_with_child prefix: part3_ postfix: fields: - field: field_grandson prefix: int_ range: 10-20 postfix: