MaibornWolff / metric-gardener

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Refactor test: use Builder pattern to create input and expected output

mylinhdao opened this issue · comments

We have many snapshot tests where each snapshot is a string of a metric object. This makes the changing of those snapshots inconvenient, for example: Changing the variable name of the metric object means searching for that variable and change every single one of them.

A better solution can be: using the builder pattern to create the expected output.

We can use this pattern to create the input, too, so units tests can be written (currently, we use files as input to write integration tests).
Note: we might need to change our function signatures to to this.