Data
Data elements are used to create and load default sets of data into DataModels. This data overwrites the default data in the value attributes of the data elements. To match the data into the correct elements, Peach will "crack" the data and fail if the data does not fit. This is done the same way data is cracked from an input Action.
There are currently three ways to load data, first is from a file, the second is via a python expression, and the third is by setting values field by field.
The Data element is a valid top level element (child of <Peach>) when defining sets of data to be referenced later on. It is also valid as a child of Action when used to both define data or reference an existing top level definition.
If multiple Data files xml blocks are specified, the attribute switchCount with the random strategy can be used to specify the number of iterations performed before switching to the next.
<DataModel name="MyDataModel"> <Block name="FooBlock"> <String name="Value" /> </Block> </DataModel> <Data name="HelloWorldDataSet"> <Field name="FooBlock.Value" value="Hello World!" /> </Data> <Data name="LoadFromFile" fileName="sample.bin" />
Attributes:
Valid Child-Elements:
Examples
<StateModel name="TheState"> <State name="initial"> <Action type="output"> <DataModel ref="TheDataModel" /> <Data name="SampleData1"> <Field name="Block1.Value" value="Hello World!" /> </Data> <Data name="SampleData2"> <Field name="Block1.Value" value="Good Afternoon World!" /> </Data> </Action> </State> </StateModel>