Data Generator Base
DataGeneratorBase
The Base Generator implementation. This class implements loading and saving of the generated data. Also it handels the instance id. If a generator is called with the same instance id it is expected that the generator returns the same data.
Kind: global class
- DataGeneratorBase
dataGeneratorBase.DataGeneratorBase
Kind: instance class of DataGeneratorBase
new exports.DataGeneratorBase()
The service registry is used to make data generators available to other generators. If a generator does not need access to other generators the serviceRegistry my be left empty
dataGeneratorBase.storeName
the file name used to store the data
Kind: instance property of DataGeneratorBase
dataGeneratorBase.store
The data here will be save and loaded
Kind: instance property of DataGeneratorBase
dataGeneratorBase.storeFileName
returns the name under which the data is stored
Kind: instance property of DataGeneratorBase
dataGeneratorBase.loadStore()
Loads the data from the file
Kind: instance method of DataGeneratorBase
dataGeneratorBase.saveStore()
Saves the data to the store
Kind: instance method of DataGeneratorBase
object
dataGeneratorBase.getStoreData() ⇒ Gibt die Daten zurück wie sie in den Store geschrieben werden würden
Kind: instance method of DataGeneratorBase
Returns: object
- storeData Der Daten wie sie im Store geschrieben werden würden
object
dataGeneratorBase.generate(instanceId, testcase, todoGenerator) ⇒ Generates the value and saves it for the given instance.
Kind: instance method of DataGeneratorBase
Returns: object
- data The genrated data. If the data could not be generated because of missing data
then the generator should return 'undefined'. So it could be called later. This may be the case if the generator
needs referenced data which is not generated yet.
Param | Type | Description |
---|---|---|
instanceId | string | The testcase instance id. for the same instance id the same data object will be returned. If this is undefined then always a new value will be created. |
testcase | object | The already generated testcase data object. |
todoGenerator | object | The generator todo |
array
dataGeneratorBase.createPostProcessTodos(instanceId, testcase, todoGenerator) ⇒ Creates the postProcessTodos. Each generator could creates todos which will be executed later on. Sometimes a generator needs to wait for other generators created there data. This function is called after the 'generate' function
Kind: instance method of DataGeneratorBase
Returns: array
- todos The generated postProcessTodos
Param | Type | Description |
---|---|---|
instanceId | string | The testcase instance id. for the same instance id the same data object will be returned. If this is undefined then always a new value will be created. |
testcase | object | The already generated testcase data object. |
todoGenerator | object | The generator todo |
dataGeneratorBase.postProcess(instanceId, testcase, todoGenerator)
This method will be called after the generate method of all the generators are called. The order is the same as before. This method does not return any data. It could update the data directly if needed
Kind: instance method of DataGeneratorBase
Param | Type | Description |
---|---|---|
instanceId | string | The testcase instance id. for the same instance id the same data object will be returned. If this is undefined then always a new value will be created. |
testcase | object | The already generated testcase object. |
todoGenerator | object | The todo action for the postprocessing |
dataGeneratorBase._doGenerate()
This method returns the generated data. It must not update the data in the testcase.
Kind: instance method of DataGeneratorBase
See: generate