How can I save lcc test statistics in a variable?

7 views
Skip to first unread message

anushre...@auto-grid.com

unread,
Jan 2, 2020, 1:10:36 AM1/2/20
to lemoncheesecake
I am trying to save the test results in a variable or to a csv file. How can I save lcc stats value especially number of test cases, failure and success rate in a variable?

Nicolas Delon

unread,
Jan 2, 2020, 8:23:03 AM1/2/20
to lemoncheesecake
Hello,

There is currently no CSV reporting backend but I have this idea in mind for a while so it could be a new feature in a future release.

Here is a code sample that allows you to get some information about a report given as argument to the script:

#!/usr/bin/env python3

import sys

from lemoncheesecake.reporting import load_report


report = load_report(sys.argv[1])
stats = report.stats()

print("Tests: %d" % stats.tests)
for status, tests_nb in stats.test_statuses.items():
    print("- %s%s" % (status, tests_nb))


BEWARE: this script uses internal, undocumented and unsupported APIs. Those APIs are subject to changes at anytime and will break your own code if you rely on it. If you use those APIs, you use them at your own risk.
You can dig into the lemoncheesecake.reporting.report module (especially the "Report" and "_Stats" classes) to get more insight of what you can get from the report/stats.

Please also note that the APIs that allows to read information and stats from the report will probably go public in the future, but it's not the case at the moment.

Best regards,

Nicolas.
Reply all
Reply to author
Forward
0 new messages