Adding a Custom Chart To Bitten
The bitten build page can show custom charts with over-time information such as the number of tests run/passed with each build, the number of lines of code in each build, etc.
Some basic steps for adding a chart to the build page.
- In the report directory create a new Python file with an implementation of IReportChartGenerator. I based my new implementation on testing.py. The generate_chart_data() method is used to gather the data to chart from the database. Note: I used a new category name (e.g. "performance" instead of "test").
- In the template directory create a new template to use to generate the chart configuration XML. I based mine on bitten_chart_tests.cs.
- Add the new Python file into the entry_points.txt file in Bitten's EGG-INFO directory. Add a new line in the "[trac.plugins]" section that points to the file you've just created.
- Add a new line in your trac.ini's "[components]" section to enable the class you've just created.
- Restart Trac and the new chart should appear on the build page.
You can inspect the XML your new Python file feeds the chart software by going to the "/build/<build name>/chart/<category>" page of your Trac install.