I was wondering which architecture/patterns to choose for the following problem divided into three steps:
- Import TestScript Description from File (e.g. .xls, .txt)
- Process Described TestScript
- Export Description with processed Results as .xml
Here is what I got so far:
- Importer that reads in xls and creates a hierarchical object structure
- Parser that creates an Abstract Syntax Tree (If,then,else,end,command) from the object structure
- A Processor (VisitorPattern) of the AST. This Processor instantiates the command implementation, executes the command, collects the results and controls the flow (if, then, else)
Currently the imported object structure already contains a field for the result and can just be serialized out as xml. But in my opinion it's not very elegant having a result field in the input objects.
The main reason I don't like it is that I can not reuse the imported object structure in order to process it multiple times. I would like to divide the whole component also into three parts:
- Import, which creates an hierarchical object structure that describes the TestScript (containing a fileparser and a preprocessor)
- Process, which creates an AST and processes it
- Export, which takes the results and the descriptions and writes it out
Here a few other conditions:
- Not every AST Node represents an object in the object structure (description)
- But each result object is connected to an description object
- Description and Results are hierarchical