At GDC, we have a graph saved in database. The structure of the graph is defined with GDCDictioanry.
To write tests for our softwares, we need to create and load fake data in our test database. The fake data is usually in yaml
format. With complicated test cases, we will need many nodes and edges in the test data. It will be hard to create or modify those fake data.
To help us with large test data, we should visualize the test data. It is much easier to understand the relationships with charts than reading
a yaml file. Graphviz is an opensource graph visualization software. Dot language is used by graphviz to create the graph. As we are mostly using python
for our develop, we use the python version of graphviz to generate our chart.
To visualize our test data, I wrote a the following script using graphviz to create a chart. And my colleague Rowland add color to
the graph so different node types will have different colors.
It simply use dot.node(node_id) to add a node to the chart and dot.edge(src_node_id, dest_node_id) to add an edge to the chart.
Now the data above will be converted to the following chart:
This is much easier for developers to analyze the data and understanding the relationships between the nodes and edges
in the data.
If the above example is not strong enough. Here is another picture. With so many nodes, it will be almost impracticle to understand and remember
all the relationships by only reading the yaml file.
This tool has made our developer work much more joyful.