Juniper / jsnapy

Python version of Junos Snapshot Administrator
Apache License 2.0
115 stars 58 forks source link

Generate static HTML result #162

Open ihsanjunaidi opened 8 years ago

ihsanjunaidi commented 8 years ago

Hi,

I think it would be more than useful if there is an option to pipe the result into a static HTML page. Currently you have to use Jinja2 template and as I understand use web framework that supports it. This is a substantial learning curve to understand Flask for example and Jinja2.

My suggestion is to have a runtime option that can generate HTML page (with nice CSS & JS) that can be customized or a step up to creating web app.

vnitinv commented 8 years ago

@ihsanjunaidi How about something like http://tungwaiyip.info/software/sample_test_report.html

dgarros commented 8 years ago

@ihsanjunaidi @vnitinv For information, I have a prototype to run JSNAPy test as part of "pytest". I need to clean up the code and share it.

The idea is that you can have a directory with all tests define, in Python/Pytest or with Jsnap and all of them will be executed together with running python -m pytest -v

Here is the current output.

➜  tests python -m pytest -v
======================================================== test session starts ========================================================
platform darwin -- Python 2.7.11, pytest-2.9.1, py-1.4.31, pluggy-0.3.1 -- /usr/local/opt/python/bin/python2.7
cachedir: .cache
rootdir: /Users/dgarros/projects/jsnapy_pytest/tests, inifile:
plugins: cov-2.2.1
collected 4 items

test_jsnapy.py::test_valid_string[127.0.0.1/2222/test_junos_alarm.yml] FAILED
test_jsnapy.py::test_valid_string[127.0.0.1/2222/test_junos_interface_ext.yml] PASSED
test_jsnapy.py::test_valid_string[127.0.0.1/2200/test_junos_alarm.yml] FAILED
test_jsnapy.py::test_valid_string[127.0.0.1/2200/test_junos_interface_ext.yml] PASSED

Because there are already some library there are already some libraries available to generate HTML report from Pytest results

For example, I tried pytest-html.
Here is an example with my script:

screen shot 2016-09-14 at 8 35 10 am

Please let me know if you are interested.

vnitinv commented 8 years ago

@dgarros @ihsanjunaidi Looks nice to me Damien

vnitinv commented 8 years ago

@dgarros How we can we integrate this? Can I expect a pull request from you for the same.