import { TestcaseData } from './TestcaseData.js'; import type { InterfaceProcessor } from './InterfaceProcessor.js'; import type { TestcaseDataInterface } from './TestcaseDataInterface.js'; import type { NodeStaticDirectiveInterface } from './NodeStaticDirectiveInterface.js'; import type { FilterProcessorInterface } from './filter/FilterProcessorInterface.js'; import type { LoggerInterface } from '../logger/index.js'; import type { DataGeneratorRegistry } from '../data-generator/index.js'; import type { InterfaceWriter } from './InterfaceWriter.js'; import type { TableInterface, TestcaseDefinitionInterface } from '../model/index.js'; import type { NodeInterface } from './NodeInterface.js'; import type { NodeFieldDirectiveInterface } from './NodeFieldDirectiveInterface.js'; export type DataWriterFunctionStatic = (testcaseData: TestcaseDataInterface, directives: NodeStaticDirectiveInterface[]) => void; export type DataWriterFunctionField = (testcaseData: TestcaseDataInterface, directives: NodeFieldDirectiveInterface[]) => void; export interface TestcaseProcessorOptions { /** All the writer used to write the data of the test cases */ writer: InterfaceWriter[]; /** The registry containing all the data generators */ generatorRegistry: DataGeneratorRegistry; /** The logger to use */ logger?: LoggerInterface; /** A function to transfer the data from a directive into the TestcaseData object */ writeMetaData?: DataWriterFunctionField; /** A function to transfer the data from a directive into the TestcaseData object */ writeStaticData?: DataWriterFunctionStatic; /** Stores all the tables by there name */ tables: Record; } export declare class TestcaseProcessor implements InterfaceProcessor { /** A function to transfer the data from a directive into the TestcaseData object */ writeMetaData: DataWriterFunctionField; /** A function to transfer the data from a directive into the TestcaseData object */ writeStaticData: DataWriterFunctionStatic; logger: LoggerInterface; /** Stores all the filter processors by there name */ filterProcessor: Map; /** The registry containing all the data generators */ generatorRegistry: DataGeneratorRegistry; /** Stores all the tables by there name */ tables: Record; /** All the writer used to write the data of the test cases */ writer: InterfaceWriter[]; constructor(opts: TestcaseProcessorOptions); /** * Adds all the given tables to the processor. * @param tables - A list of tables */ addTables(tables: TableInterface | TableInterface[]): void; /** * Deletes the loaded tables * and also the data of the generators */ clear(): void; /** * Adds a new filterProcessor to the processor * @param filterProcessor - A filterProcessor object */ addFilterProcessor(filterProcessor: FilterProcessorInterface): void; /** * Returns a filterProcessor with the given name * @param name - The name of this filterProcessor * @returns The filterProcessor with the given name or undefined if the processor does not exists */ getFilterProcessor(name: string): FilterProcessorInterface | undefined; process(): Promise; /** * Processes a single table * @param table - The table object to be executed */ processTable(table: TableInterface): Promise; /** * Calls the generator for post processing * @param testcaseData - The testcaseData object wich stores all the information of this testcase * @returns True if the directive is fullfilled */ postProcessGenerators(testcaseData: TestcaseDataInterface): Promise; /** * Processes a single testcase of a table. This method is called * from the TableProcessor. This is the entry point for a single testcase. * @param testcaseDefinition - The Testcase definition to be executed * @returns An array TestcaseData Objects */ processTestcase(testcaseDefinition: TestcaseDefinitionInterface): Promise; /** * Returns false if this test case has a filter and the test case does not * match the filter criteria * @param testcaseDefinition - The Testcase definition to be executed * @param callTree - The RootObject of the callTree * @returns An array TestcaseData Objects */ private isFilterOk; /** * Iterates through the call tree and checks if there is an element with neverExceute=true * @param callTree - The RootObject of the callTree * @returns True, if one child object has neverExecute=true */ private isNeverExecute; /** * Get all the tags of all the nodes in one array back. * @param callTree - Das RootObject des callTrees * @returns An array with all the tags */ private getTags; /** * Builds the call tree for this test case data object. * This tree could be used to create the test case names * or what ever you need * @param node - The parent node * @returns The created callTree object */ private buildCallTree; /** * Generates the test case data for a node. * Also calls recursively all the referenced nodes for data * creation. The created data is stored in the given testcaseData * object. * @param testcaseData - The testcase data object for storing the data * @param node - The node to create the data for * @param generatorSwitches - A list of generator names to be skipped */ private generateData; /** * Calls the generator and stores the data in the data object. * Important: When calling a generator with an instanceId suffix then * this is only for the generator. The data will be stored using the * instanceId of the node. * @param testcaseData - The testcase data object for storing the data * @param generatorDirectives - An array of generator directives * @returns The number of succesful generator calls and the still open directives */ private executeGeneratorDirectives; /** * * @param testcaseData - The testcase data object for storing the data * @param referenceDirectives - An array of reference directives * @returns The number of succesful reference calls and the still open directives */ private executeReferenceDirectives; /** * This method creates the node trees for one testcaseDefinition * @param testcaseDefinition - The Testcase definition to be executed * @returns The new nodes created */ createNodeTree(testcaseDefinition: TestcaseDefinitionInterface): Promise; /** * If the nodes are exploded we have copied instanceIDs. * So we need to recreate the instanceIds for all the rootNodes * to make sure they are unique * @param node - The node object to change the instanceIds * @param idMap - An object containing the newly mapped Ids. (Empty for the root node) * @param done - A set containing all the already translated IDs */ private recreateInstanceIds; /** * Traverses the references of this node. Just update the node with the references * @param node - The raw node with the unexpanded references * @returns An Array with the nodes created by the references */ private explodeNodeReferences; } //# sourceMappingURL=TestcaseProcessor.d.ts.map