Search code examples
pythonhtmliperf

Python - Documenting Test Results via HTML


This is definitely the most vague question I have asked on SO but I hope it will not be too heavily frowned upon.

I recently started a project for the company I am interning at this summer. The task is to test traffic between two servers using the program iperf.

Long story short: I am successfully able to run the tests, get the data (saved as a txt file), and generate graphs all in python (company specification of language).

My question for all is how can I create a webpage to store this information via python? The webpage would not need to be complicated by any stretch of the imagination. What I am imagining is that every time a test case is run it adds a link to a "homepage" once the user clicks on that link they will have the test results. Test results would be something along the lines of the graphs (perhaps in iframes?) and the txt file (also in an iframe?). Nothing exciting.

I am extremely lost on how to even start something like. Any and all guidance would be helpful.


Solution

  • I think what you're looking for is a templating engine for Python. Jinja2 is a good example of one.

    Jinja2 is a full featured template engine for Python. It has full unicode support, an optional integrated sandboxed execution environment, widely used and BSD licensed. source

    You could pull the test data into Python and generate a dashboard-style webpage with it. If you're looking for something more powerful, take a look at Flask, which is a microframework and uses Jinja2, and combine it with Highcharts