From 71de5ea909ea16463a985f077a960153f9adc9db Mon Sep 17 00:00:00 2001 From: Clay Sweetser Date: Fri, 7 Mar 2014 17:50:57 -0500 Subject: [PATCH 1/2] Tester now outputs all the test results of the current test run to json. --- tests/testament/htmlgen.nim | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/testament/htmlgen.nim b/tests/testament/htmlgen.nim index 74d8811b87..93e3a4270a 100644 --- a/tests/testament/htmlgen.nim +++ b/tests/testament/htmlgen.nim @@ -174,6 +174,10 @@ proc generateJson*(filename: string, commit: int) = on A.name = B.name and A.category = B.category where A.[commit] = ? and B.[commit] = ? and A.machine = ? and A.result != B.result""" + selResults = """select + name, category, target, action, result, expected, given + from TestResult + where [commit] = ?""" var db = open(connection="testament.db", user="testament", password="", database="testament") let lastCommit = db.getCommit(commit) @@ -189,6 +193,21 @@ proc generateJson*(filename: string, commit: int) = outfile.writeln("""{"total": $#, "passed": $#, "skipped": $#""" % data) + let results = newJArray() + for row in db.rows(sql(selResults), lastCommit): + echo(repr(row)) + var obj = newJObject() + obj["name"] = %row[0] + obj["category"] = %row[1] + obj["target"] = %row[2] + obj["action"] = %row[3] + obj["result"] = %row[4] + obj["expected"] = %row[5] + obj["given"] = %row[6] + results.add(obj) + outfile.writeln(""", "results": """) + outfile.write(results.pretty) + if not previousCommit.isNil: let diff = newJArray() From 5f19af9e01bf30b1b28c410377f919e02fc6f1cc Mon Sep 17 00:00:00 2001 From: Clay Sweetser Date: Sat, 8 Mar 2014 14:30:05 -0500 Subject: [PATCH 2/2] Removed debug code --- tests/testament/htmlgen.nim | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/testament/htmlgen.nim b/tests/testament/htmlgen.nim index 93e3a4270a..89d56c6936 100644 --- a/tests/testament/htmlgen.nim +++ b/tests/testament/htmlgen.nim @@ -195,7 +195,6 @@ proc generateJson*(filename: string, commit: int) = let results = newJArray() for row in db.rows(sql(selResults), lastCommit): - echo(repr(row)) var obj = newJObject() obj["name"] = %row[0] obj["category"] = %row[1]