Data Generator Interface
DataGeneratorInterface
The interface definition for all the data generators. The Processor uses the data generators to create the data.
Kind: global class
- DataGeneratorInterface
- .DataGeneratorInterface
- .logger
- .serviceRegistry
- .unique
- .maxUniqueTries
- .uniqueSet
- .instanceData
- .varDir
- .useStore
- .name
- .loadStore()
- .saveStore()
- .getGenerator(serviceName) ⇒
object
- .clearContext()
- .generate(instanceId, testcase, todoGenerator) ⇒
object
- .createPostProcessTodos(instanceId, testcase, todoGenerator) ⇒
array
- .postProcess(instanceId, testcase, todoGenerator)
dataGeneratorInterface.DataGeneratorInterface
Kind: instance class of DataGeneratorInterface
new exports.DataGeneratorInterface(serviceRegistry, args)
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
Param | Type | Description |
---|---|---|
serviceRegistry | object | The service registry with all the registered generators. |
args | object | Any arguments to configure this generator. |
dataGeneratorInterface.logger
The logger used for logging
Kind: instance property of DataGeneratorInterface
dataGeneratorInterface.serviceRegistry
The registry where all the available generators are registered
Kind: instance property of DataGeneratorInterface
dataGeneratorInterface.unique
If set to a true value the data generator should return unique values What unique means depends on the generator. If the generator create more than one field is up to the generator
Kind: instance property of DataGeneratorInterface
dataGeneratorInterface.maxUniqueTries
Defines how many tries the generator will do for getting a unique value until it throws an error
Kind: instance property of DataGeneratorInterface
dataGeneratorInterface.uniqueSet
Stores the data which needs to be unique
Kind: instance property of DataGeneratorInterface
dataGeneratorInterface.instanceData
Stores the data per testcase instance id
Kind: instance property of DataGeneratorInterface
dataGeneratorInterface.varDir
The directory used to store the unique data
Kind: instance property of DataGeneratorInterface
dataGeneratorInterface.useStore
Should this generator use a store
Kind: instance property of DataGeneratorInterface
dataGeneratorInterface.name
Is set when this generator is registered in the service registry
Kind: instance property of DataGeneratorInterface
dataGeneratorInterface.loadStore()
Loads the data from the file.
Kind: instance method of DataGeneratorInterface
dataGeneratorInterface.saveStore()
Saves the data to the store
Kind: instance method of DataGeneratorInterface
object
dataGeneratorInterface.getGenerator(serviceName) ⇒ Returns the Datagenerator registered under the given name. If the generator is not found an error will be thrown
Kind: instance method of DataGeneratorInterface
Returns: object
- generator The generator
Param | Type | Description |
---|---|---|
serviceName | string | The name of the registered data generator |
dataGeneratorInterface.clearContext()
Resets the context. The context stores the already generated data and is used also to check if data is unique.
Kind: instance method of DataGeneratorInterface
object
dataGeneratorInterface.generate(instanceId, testcase, todoGenerator) ⇒ Generates the value and saves it for the given instance.
Kind: instance method of DataGeneratorInterface
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
dataGeneratorInterface.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 DataGeneratorInterface
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 |
dataGeneratorInterface.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 DataGeneratorInterface
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 |