mercredi 7 septembre 2016

How to test objects depending on complex data structure?

I'm struggeling with more theoretical question. How can you test something that operates with quite complex structure?

For example I have a converter, which converts more leveled data structure. So I divide this conversion to more sub-converters and let say one "master" converter, so I can test them separately. Tests for sub-converters are quite easy, because they depend only on primitive data types or low level complexity data structures.

But problem is how to test the "master" converter, which requires all this sub-converters and also complex data structure to test overall result.

To example, I need to convert data object, which has on first level some primitive types and one complex type. This complex type consists of primitive types and again one complex type which than finally represents only primitive types. That means 3 levels of nesting logically, or 6 in real, because there could be some field objects (Lists ect.) contain these complex types.

And to preper testing data for this complex strucuture is not nice. Not even mention I've heard a statement once, that anytime you have to do a complex set up in tests means you are doing something wrong. I know it's not a dogma, but the feeling about this is not good.

So am I trying to test something, that shouldn't be tested? Or am I trying wrong approach for creating tests?

Aucun commentaire:

Enregistrer un commentaire