diff options
author | Christian Stenger <christian.stenger@digia.com> | 2013-03-04 11:02:55 +0100 |
---|---|---|
committer | Christian Stenger <christian.stenger@digia.com> | 2013-03-06 08:49:38 +0100 |
commit | 2ed55c8076d810df6d16a652a44ace53dc17998c (patch) | |
tree | 163f8827469ce7183b60dec0fb47aa4531fd3da5 | |
parent | c401068bfc62f5f19bbac7d38060af2cb9ce10e5 (diff) |
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>
-rw-r--r-- | tests/system/shared/qtcreator.py | 3 | ||||
-rw-r--r-- | tests/system/shared/utils.py | 14 |
2 files changed, 17 insertions, 0 deletions
diff --git a/tests/system/shared/qtcreator.py b/tests/system/shared/qtcreator.py index 3f761f855d..f992c2dd1f 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 0ed88890bb..b42bba60b8 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() |