diff --git a/tests/system/shared/qtcreator.py b/tests/system/shared/qtcreator.py index 3f761f855d6f0ed0b53712a2fd8526f1d92b673d..f992c2dd1f4c4bbabec7494bd52708c18f185336 100644 --- a/tests/system/shared/qtcreator.py +++ b/tests/system/shared/qtcreator.py @@ -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")) diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py index 0ed88890bb2aae78cbc907c73bb770f6edfda86b..b42bba60b84c23431dbf8a59b04e4018f05ee839 100644 --- a/tests/system/shared/utils.py +++ b/tests/system/shared/utils.py @@ -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()