We have some problems figuring out how to mock complex data and operations on it.
First the problems with generating complex data:
In one of our components we have really complex data structures where the logic of our classes is executed. Unfortunate there are some bugs, where it is necessary to use a big data model to reproduce the case in a unit or integration test. The first idea was to write a script which converts the model to executable code, with which the data can be generated. To show the complexity of the models, these converted models had 20000++ line of code per model.
The problem with the first approach was, that we had some little mistakes in our script and every time we identified one we had to rewrite all models. That was no good idea. The second idea is to use the xml files in which they are saved. Before the test starts we use a class to convert the xml file to the model. The result is better than the first idea, but with this we will never have plain unit tests, because we always rely on the class used for the conversion.
Has someone a better idea how to deal with this issue?
The second problem is even harder to solve: manipulation of this complex data.
We have a integration test of another component and want to mock all its dependencies. Somehow we create the initial data used by the component (some kind of AST). Now we a syntax check component as a dependency. This component takes in the data and decorates the data. So in the end we have another manipulated AST in the test.
Here we have no idea, how to mock this behavior of the syntax check.