Squish: Provide function for writing out results

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

Change-Id: Ieeab062b426ac3b9053d0499fdb38f0abacb89c9
Reviewed-by: Robert Loehning <robert.loehning@digia.com>
This commit is contained in:
Christian Stenger
2013-03-04 11:02:55 +01:00
parent c401068bfc
commit 2ed55c8076
2 changed files with 17 additions and 0 deletions

View File

@@ -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()