Commit 2ed55c80 authored by Christian Stenger's avatar Christian Stenger

Squish: Provide function for writing out results

...in preparation for adding these to the automatic statistic thingy.

Change-Id: Ieeab062b426ac3b9053d0499fdb38f0abacb89c9
Reviewed-by: default avatarRobert Loehning <robert.loehning@digia.com>
parent c401068b
......@@ -206,3 +206,6 @@ if os.getenv("SYSTEST_NOSETTINGSPATH") != "1":
cwd = os.path.abspath(cwd)
copySettingsToTmpDir()
atexit.register(__removeTestingDir__)
if os.getenv("SYSTEST_WRITE_RESULTS") == "1" and os.getenv("SYSTEST_RESULTS_FOLDER") != None:
atexit.register(writeTestResults, os.getenv("SYSTEST_RESULTS_FOLDER"))
......@@ -567,3 +567,17 @@ def dumpItems(model, parent=None, role=DisplayRole, column=0):
# returns the children of a QTreeWidgetItem
def dumpChildren(item):
return [item.child(index) for index in range(item.childCount())]
def writeTestResults(folder):
if squishinfo.version < 0x040200FF:
print "Skipping writing test results (Squish < 4.2)"
return
if not os.path.exists(folder):
print "Skipping writing test results (folder '%s' does not exist)." % folder
return
resultFile = open("%s.srf" % os.path.join(folder, os.path.basename(squishinfo.testCase)), "w")
resultFile.write("suite:%s\n" % os.path.basename(os.path.dirname(squishinfo.testCase)))
categories = ["passes", "fails", "fatals", "errors", "tests", "warnings", "xfails", "xpasses"]
for cat in categories:
resultFile.write("%s:%d\n" % (cat, test.resultCount(cat)))
resultFile.close()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment