2 new revisions:

Revision: 462bcce2f5b1
Author:   Pekka Klärck
Date:     Wed Jan  4 15:44:02 2012
Log: Fixed create_jsdata.py to work with the current js model and writer. N...
http://code.google.com/p/robotframework/source/detail?r=462bcce2f5b1

Revision: 5d2d29f8b7ce
Author:   Pekka Klärck
Date:     Wed Jan  4 15:44:12 2012
Log:      regen
http://code.google.com/p/robotframework/source/detail?r=5d2d29f8b7ce

==============================================================================
Revision: 462bcce2f5b1
Author:   Pekka Klärck
Date:     Wed Jan  4 15:44:02 2012
Log: Fixed create_jsdata.py to work with the current js model and writer. Notice that a bug in JsonWriter currently makes it impossible to use this script (unless you workaround the bug). I'll fix the bug tomorrow. Needing to extend JsResultWriter in order to set block separators is annoying. Should move them back to optional args to __init__.
http://code.google.com/p/robotframework/source/detail?r=462bcce2f5b1

Modified:
 /src/robot/webcontent/testdata/create_jsdata.py

=======================================
--- /src/robot/webcontent/testdata/create_jsdata.py     Mon Oct 24 03:12:31 2011
+++ /src/robot/webcontent/testdata/create_jsdata.py     Wed Jan  4 15:44:02 2012
@@ -1,39 +1,52 @@
 #!/usr/bin/env python

-from os.path import abspath, dirname, join
+from os.path import abspath, dirname, normpath, join
 import os
 import sys
+import codecs

 BASEDIR = dirname(abspath(__file__))
+LOG = normpath(join(BASEDIR, '..', 'log.html'))
 TESTDATA = join(BASEDIR, 'dir.suite')
 OUTPUT = join(BASEDIR, 'output.xml')
 TARGET = join(BASEDIR, 'data.js')
-
-sys.path.insert(0, join(BASEDIR, '..', '..', '..'))
+SRC = normpath(join(BASEDIR, '..', '..', '..'))
+
+sys.path.insert(0, SRC)

 import robot
-from robot.reporting.outputparser import OutputParser
+from robot.conf.settings import RebotSettings
+from robot.reporting.resultwriter import Results
+from robot.reporting.jswriter import JsResultWriter


-def run_robot(outputdirectory, testdata):
-    robot.run(testdata, log='NONE', report='NONE',
-              tagstatlink=['force:http://google.com:<kuukkeli&gt;',
-                           'i*:http://%1/:Title of i%1'],
-              tagdoc=['test:this_is_*my_bold*_test',
-                      'IX:*Combined* & escaped <&lt; tag doc'],
-              tagstatcombine=['fooANDi*:zap', 'i?:IX'],
- critical=['i?'], noncritical=['*kek*kone*'], outputdir=outputdirectory)
+class ResultWriter(JsResultWriter):
+    start_block = ''
+    end_block = ''
+
+
+def run_robot(testdata, outxml):
+    robot.run(testdata, log='NONE', report='NONE', output=outxml)


 def create_jsdata(outxml, target):
- model = OutputParser(log_path=join(BASEDIR,'..','log.html')).parse(outxml)
-    model.set_settings({'logURL': 'log.html',
-                        'reportURL': 'report.html',
-                        'background': {'fail': 'DeepPink'}})
-    with open(target, 'w') as output:
-        model.write_to(output)
+    print outxml
+    settings = RebotSettings(
+        dict(tagstatlink=['force:http://google.com:<kuukkeli&gt;',
+                          'i*:http://%1/:Title of i%1'],
+             tagdoc=['test:this_is_*my_bold*_test',
+                     'IX:*Combined* & escaped <&lt; tag doc'],
+             tagstatcombine=['fooANDi*:No Match', 'i?:IX'],
+             critical=['i?'], noncritical=['*kek*kone*']))
+    result = Results([outxml], settings).js_result
+    config = dict(logURL='log.html',
+                  reportURL='report.html',
+                  background={'fail': 'DeepPink'})
+    with codecs.open(target, 'w', 'UTF-8') as output:
+        ResultWriter(output).write(result, config)
+

 if __name__ == '__main__':
-    run_robot(BASEDIR, TESTDATA)
+    run_robot(TESTDATA, OUTPUT)
     create_jsdata(OUTPUT, TARGET)
     os.remove(OUTPUT)

==============================================================================
Revision: 5d2d29f8b7ce
Author:   Pekka Klärck
Date:     Wed Jan  4 15:44:12 2012
Log:      regen
http://code.google.com/p/robotframework/source/detail?r=5d2d29f8b7ce

Modified:
 /src/robot/webcontent/testdata/data.js

=======================================
--- /src/robot/webcontent/testdata/data.js      Thu Jul 14 15:35:50 2011
+++ /src/robot/webcontent/testdata/data.js      Wed Jan  4 15:44:12 2012
@@ -1,11 +1,10 @@
 window.output = {};
-window.output["errors"] = [[36,5,86]];
-window.output["stats"] = [[{"fail":3,"label":"Critical Tests","pass":2},{"fail":4,"label":"All Tests","pass":2}],[{"fail":4,"info":"critical","label":"i1","links":"Title of i1:http://1/","pass":2},{"fail":4,"info":"critical","label":"i2","links":"Title of i2:http://2/","pass":2},{"fail":1,"info":"non-critical","label":"owner-kekkonen","pass":0},{"combined":"i?","doc":";<b>Combined</b> &amp; escaped &lt;&amp;lt; tag doc","fail":4,"info":"combined","label":"IX","links":"Title of iX:http://X/","pass":2},{"combined":"foo & i*","fail":0,"info":"combined","label":"zap","pass":0},{"fail":1,"label":"!\"#%&/()=","pass":0},{"fail":4,"label":"< &lt; \u00e4","pass":0},{"fail":0,"label":"collections","pass":2},{"fail":1,"label":"default with percent %","pass":0},{"fail":4,"label":"force","links":"<kuukkeli&gt;:http://google.com","pass":0},{"fail":1,"label":"t1","pass":0},{"fail":4,"label":"with space","pass":0},{"fail":1,"label":"with unicode \u5b98\u8bdd","pass":0}],[{"fail":4,"id":"s1","label":"Dir.Suite","name":"Dir.Suite","pass":2},{"fail":0,"id":"s1-s1","label":"Dir.Suite.Test.Suite.1","name":"Test.Suite.1","pass":1},{"fail":0,"id":"s1-s2","label":"Dir.Suite.Test.Suite.2","name":"Test.Suite.2","pass":1},{"fail":4,"id":"s1-s3","label":"Dir.Suite.Tests","name":"Tests","pass":0}]];
-window.output["generatedMillis"] = 5;
-window.output["generator"] = "robot";
-window.output["generatedTimestamp"] = "20110715 01:33:40 GMT +03:00";
-window.output["baseMillis"] = 1310682819995;
-window.output["suite"] = [1,2,3,4,[5,6,7,8,9,10,11,12],[0,-45,137],[[16,17,18,0,[],[1,1,19],[],[[28,0,1,0,[25,26,27],[1,14,5],[[0,22,0,19,20,[1,15,1],[],[[17,2,21]]],[0,15,0,13,23,[1,17,1],[],[[18,2,24]]]]]],[],0,[1,1,1,1]],[29,30,31,0,[],[1,21,10],[],[[38,0,1,0,[25,26,27],[1,25,5],[[0,35,0,32,33,[1,26,1],[],[[28,2,34]]],[0,15,0,13,36,[1,28,1],[],[[29,2,37]]]]]],[],0,[1,1,1,1]],[39,40,41,42,[43,44,45,12],[0,32,59,85],[],[[53,0,1,0,[43,50,51,26,27,52],[1,39,6],[[1,15,0,13,47,[1,41,1],[],[[41,2,47]]],[0,15,0,13,48,[1,42,1],[],[[43,2,48]]],[2,15,0,13,49,[1,44,1],[],[[45,2,49]]]]],[61,0,1,0,[60,43,51,26,27,52],[0,47,11,56],[[1,15,0,13,47,[1,48,1],[],[[49,2,47]]],[0,15,0,13,54,[1,49,2],[],[[50,2,55]]],[0,15,0,13,56,[1,51,1],[],[[52,2,57]]],[0,59,0,58,56,[0,53,3],[],[[56,4,57]]],[2,15,0,13,49,[1,57,1],[],[[57,2,49]]]]],[64,0,1,0,[43,51,26,27,52,63],[1,59,6],[[1,15,0,13,47,[1,60,1],[],[[61,2,47]]],[0,15,0,13,62,[1,62,1],[],[[63,2,62]]],[2,15,0,13,49,[1,63,1],[],[[64,2,49]]]]],[83,0,0,65,[43,51,26,27,81,82,52],[1,66,22],[[1,15,0,13,66,[1,68,1],[],[[68,2,66]]],[0,15,0,13,67,[1,69,1],[],[[70,2,67]]],[0,69,0,0,0,[1,71,3],[[0,15,0,13,68,[1,72,2],[],[[73,2,68]]]],[]],[3,79,0,0,0,[1,75,11],[[4,72,0,0,0,[1,75,3],[[0,15,0,13,70,[1,76,1],[],[[77,2,71]]]],[]],[4,74,0,0,0,[1,78,2],[[0,15,0,13,70,[1,79,1],[],[[80,2,73]]]],[]],[4,76,0,0,0,[1,81,2],[[0,15,0,13,70,[1,81,1],[],[[82,2,75]]]],[]],[4,78,0,0,0,[1,83,2],[[0,15,0,13,70,[1,84,1],[],[[85,2,77]]]],[]]],[]],[2,15,0,13,80,[1,86,1],[],[[87,2,80]]]]]],[[1,15,0,13,46,[1,38,1],[],[[39,2,46]]],[2,59,0,58,0,[0,89,1],[],[[90,4,84]]]],1,[4,0,3,0]]],[],[[1,15,0,13,14,[1,-1,1],[],[[0,2,14]]]],0,[6,2,5,2]]; +window.output["suite"] = [1,2,3,4,[5,6,7,8,9,10,11,12],[0,0,140],[[13,14,15,0,[],[1,50,19],[],[[16,0,1,0,[17,18,19],[1,64,5],[[0,20,0,21,22,[1,65,1],[],[[67,2,23]]],[0,24,0,25,26,[1,67,1],[],[[68,2,27]]]]]],[],[1,1,1,1]],[28,29,30,0,[],[1,70,10],[],[[31,0,1,0,[17,18,19],[1,75,4],[[0,32,0,33,34,[1,76,1],[],[[77,2,35]]],[0,24,0,25,36,[1,78,1],[],[[79,2,37]]]]]],[],[1,1,1,1]],[38,39,40,41,[42,43,44,12],[0,81,58,45],[],[[46,0,1,0,[42,47,48,18,19,49],[0,89,6,50],[[1,24,0,25,51,[1,90,1],[],[[91,2,51]]],[0,24,0,25,52,[1,92,1],[],[[93,2,52]]],[2,24,0,25,53,[1,93,1],[],[[94,2,53]]]]],[54,0,1,0,[55,42,48,18,19,49],[0,96,13,56],[[1,24,0,25,51,[1,97,1],[],[[98,2,51]]],[0,24,0,25,57,[1,99,1],[],[[99,2,58]]],[0,24,0,25,59,[1,100,1],[],[[101,2,60]]],[0,61,0,62,59,[0,102,5],[],[[106,4,60]]],[2,24,0,25,53,[1,107,1],[],[[108,2,53]]]]],[63,0,1,0,[42,48,18,19,49,64],[0,110,6,50],[[1,24,0,25,51,[1,111,1],[],[[112,2,51]]],[0,24,0,25,65,[1,113,1],[],[[113,2,65]]],[2,24,0,25,53,[1,114,1],[],[[115,2,53]]]]],[66,0,0,67,[42,48,18,19,68,69,49],[0,117,19,50],[[1,24,0,25,70,[1,118,1],[],[[119,2,70]]],[0,24,0,25,71,[1,119,1],[],[[120,2,71]]],[0,72,0,0,0,[1,121,3],[[0,24,0,25,73,[1,122,1],[],[[123,2,73]]]],[]],[3,74,0,0,0,[1,124,10],[[4,75,0,0,0,[1,125,2],[[0,24,0,25,76,[1,125,2],[],[[126,2,77]]]],[]],[4,78,0,0,0,[1,127,2],[[0,24,0,25,76,[1,128,1],[],[[129,2,79]]]],[]],[4,80,0,0,0,[1,130,2],[[0,24,0,25,76,[1,130,1],[],[[131,2,81]]]],[]],[4,82,0,0,0,[1,132,2],[[0,24,0,25,76,[1,132,1],[],[[133,2,83]]]],[]]],[]],[2,24,0,25,84,[1,135,1],[],[[135,2,84]]]]]],[[1,24,0,25,85,[1,88,1],[],[[88,2,85]]],[2,61,0,62,0,[0,138,1],[],[[138,4,86]]]],[4,0,3,0]]],[],[[1,24,0,25,87,[1,48,1],[],[[49,2,87]]]],[6,2,5,2]];
 window.output["strings"] = [];
-window.output["strings"] = window.output["strings"].concat(["*","*Dir.Suite","*/home/peke/Devel/robotframework/src/robot/webcontent/testdata/dir.suite","*testdata/dir.suite","eNqdkEtOxDAMhvecwsoBapVllYY1EmwQHCCvphEprhxLTG8/zQyPCsGGjSXb3//Jsnbm5elh0OgMaAszx2lUs8g6IDI5kontEt+JXzvipMyfK43W3Ohs7heb4u7Luy8vCSr7L6GnELtElErsPC24/vBgoUR38STd+pYUSJYS/xuusrWwIw6RB+jXE1QqOUBiu6n91JmNFutKhCszql6BL7bWUQXyDRFuJRjtzOPWXqRx7z5Hzy18mOIV/8j03+ztr8BEdNAdCbycZc59kYfm","*Escape","*&lt; &amp;lt;","*Formatting","*<b>Bold</b> and <i>italics</i>","*Image","eNqdy8ENgzAMBdBVrAwQiyui7SyQGDdq0h85loDtK1bou7+lNKVh6RHe7n1mTsgSFdAqMaFxZ8MG321tcsA+XKF4yemxfzWQF6/ybx5+3XmDZbGZpn7SQC2Z1NYrPH9nfDiV","*URL","*<a href=\"http://robotframework.org\";>http://robotframework.org</a>","*Logs the given message with the given level.","*higher level suite setup","*BuiltIn.Log","*Test.Suite.1","*/home/peke/Devel/robotframework/src/robot/webcontent/testdata/dir.suite/test.suite.1.txt","*testdata/dir.suite/test.suite.1.txt","*Returns a list containing given items.","*foo, bar, quux","*${list} = [u'foo', u'bar', u'quux']","*${list} = BuiltIn.Create List","*${list}","*[u'foo', u'bar', u'quux']","*collections","*i1","*i2","*list test","*Test.Suite.2","*/home/peke/Devel/robotframework/src/robot/webcontent/testdata/dir.suite/test.suite.2.txt","*testdata/dir.suite/test.suite.2.txt","*Creates and returns a dictionary from the given `key_value_pairs`.","*key, value","*${dict} = {u'key': u'value'}","*${dict} = Collections.Create Dictionary","*${dict}","*{u'key': u'value'}","*Dictionary test","*Tests","*/home/peke/Devel/robotframework/src/robot/webcontent/testdata/dir.suite/tests.txt","*testdata/dir.suite/tests.txt","*Some suite <i>docs</i> with links: <a href=\"http://robotframework.org\";>http://robotframework.org</a>","*< &lt; \u00e4","*&lt; &amp;lt; \u00e4","*home *page*","*Suite setup","*Test Setup","*do nothing","*Test Teardown","*default with percent %","*force","*with space","*Simple","*<blink><b><font face=\"comic sans ms\" size=\"42\" color=\"red\">CAN HAZ HMTL & NO CSS?!?!??!!?</font></b></blink>, HTML","*<blink><b><font face=\"comic sans ms\" size=\"42\" color=\"red\">CAN HAZ HMTL & NO CSS?!?!??!!?</font></b></blink>","*escape < &lt; <b>no bold</b>","*escape &lt; &amp;lt; &lt;b&gt;no bold&lt;/b&gt;","*Fails the test immediately with the given (optional) message.","*BuiltIn.Fail","*!\"#%&/()=","*Log HTML","*hyv\u00e4\u00e4 joulua","*with unicode \u5b98\u8bdd","*Unicode","*Test doc","*in own setup","*in test","*in User Kw","*User Kw","*Got ${i}","*Got 1","*${i} = 1","*Got 2","*${i} = 2","*Got 3","*${i} = 3","*Got 4","*${i} = 4","*${i} IN [ @{list} ]","*in own teardown","*owner-kekkonen","*t1","*Complex","*AssertionError","*Suite teardown failed:\nAssertionError","*Invalid syntax in file '/home/peke/Devel/robotframework/src/robot/webcontent/testdata/dir.suite/tests.txt' in table 'Settings': Test library 'p\u00f6lk\u00fc/myLib.py' does not exist."]); +window.output["strings"] = window.output["strings"].concat(["*","*Dir.Suite","*/home/peke/Devel/robotframework/src/robot/webcontent/testdata/dir.suite","*src/robot/webcontent/testdata/dir.suite","eNqdkEtOxDAMhvecwsoBapVllYY1EmwQHCCvphEprhxLTG8/zQyPCsGGjSXb3//Jsnbm5elh0OgMaAszx2lUs8g6IDI5kontEt+JXzvipMyfK43W3Ohs7heb4u7Luy8vCSr7L6GnELtElErsPC24/vBgoUR38STd+pYUSJYS/xuusrWwIw6RB+jXE1QqOUBiu6n91JmNFutKhCszql6BL7bWUQXyDRFuJRjtzOPWXqRx7z5Hzy18mOIV/8j03+ztr8BEdNAdCbycZc59kYfm","*Escape","*&lt; &amp;lt;","*Formatting","*<b>Bold</b> and <i>italics</i>","*Image","eNqdy8ENgzAMBdBVrAwQiyui7SyQGDdq0h85loDtK1bou7+lNKVh6RHe7n1mTsgSFdAqMaFxZ8MG321tcsA+XKF4yemxfzWQF6/ybx5+3XmDZbGZpn7SQC2Z1NYrPH9nfDiV","*URL","*<a href=\"http://robotframework.org\";>http://robotframework.org</a>","*Test.Suite.1","*/home/peke/Devel/robotframework/src/robot/webcontent/testdata/dir.suite/test.suite.1.txt","*src/robot/webcontent/testdata/dir.suite/test.suite.1.txt","*list test","*collections","*i1","*i2","*${list} = BuiltIn.Create List","*Returns a list containing given items.","*foo, bar, quux","*${list} = [u'foo', u'bar', u'quux']","*BuiltIn.Log","*Logs the given message with the given level.","*${list}","*[u'foo', u'bar', u'quux']","*Test.Suite.2","*/home/peke/Devel/robotframework/src/robot/webcontent/testdata/dir.suite/test.suite.2.txt","*src/robot/webcontent/testdata/dir.suite/test.suite.2.txt","*Dictionary test","*${dict} = Collections.Create Dictionary","*Creates and returns a dictionary from the given `key_value_pairs`.","*key, value","*${dict} = {u'key': u'value'}","*${dict}","*{u'key': u'value'}","*Tests","*/home/peke/Devel/robotframework/src/robot/webcontent/testdata/dir.suite/tests.txt","*src/robot/webcontent/testdata/dir.suite/tests.txt","*Some suite <i>docs</i> with links: <a href=\"http://robotframework.org\";>http://robotframework.org</a>","*< &lt; \u00e4","*&lt; &amp;lt; \u00e4","*home *page*","*Suite teardown failed:\nAssertionError","*Simple","*default with percent %","*force","*with space","*Teardown of the parent suite failed.","*Test Setup","*do nothing","*Test Teardown","*Log HTML","*!\"#%&/()=","*escape < &lt; <b>no bold</b>\n\nAlso teardown of the parent suite failed.","*<blink><b><font face=\"comic sans ms\" size=\"42\" color=\"red\">CAN HAZ HMTL & NO CSS?!?!??!!?</font></b></blink>, HTML","*<blink><b><font face=\"comic sans ms\" size=\"42\" color=\"red\">CAN HAZ HMTL & NO CSS?!?!??!!?</font></b></blink>","*escape < &lt; <b>no bold</b>","*escape &lt; &amp;lt; &lt;b&gt;no bold&lt;/b&gt;","*BuiltIn.Fail","*Fails the test immediately with the given (optional) message.","*Unicode","*with unicode \u5b98\u8bdd","*hyv\u00e4\u00e4 joulua","*Complex","*Test doc","*owner-kekkonen","*t1","*in own setup","*in test","*User Kw","*in User Kw","*${i} IN [ @{list} ]","*${i} = 1","*Got ${i}","*Got 1","*${i} = 2","*Got 2","*${i} = 3","*Got 3","*${i} = 4","*Got 4","*in own teardown","*Suite setup","*AssertionError","*higher level suite setup","*Error in file '/home/peke/Devel/robotframework/src/robot/webcontent/testdata/dir.suite/tests.txt' in table 'Settings': Test library 'p\u00f6lk\u00fc/myLib.py' does not exist."]);
+window.output["generatedTimestamp"] = "20120105 01:39:28 GMT +03:00";
+window.output["errors"] = [[86,5,88]];
+window.output["stats"] = [[{"fail":3,"label":"Critical Tests","pass":2},{"fail":4,"label":"All Tests","pass":2}],[{"fail":4,"info":"critical","label":"i1","links":"Title of i1:http://1/","pass":2},{"fail":4,"info":"critical","label":"i2","links":"Title of i2:http://2/","pass":2},{"fail":1,"info":"non-critical","label":"owner-kekkonen","pass":0},{"combined":"i?","doc":"*Combined* & escaped <&lt; tag doc","fail":4,"info":"combined","label":"IX","links":"Title of iX:http://X/","pass":2},{"combined":"foo & i*","fail":0,"info":"combined","label":"No Match","pass":0},{"fail":1,"label":"!\"#%&/()=","pass":0},{"fail":4,"label":"< &lt; \u00e4","pass":0},{"fail":0,"label":"collections","pass":2},{"fail":1,"label":"default with percent %","pass":0},{"fail":4,"label":"force","links":"<kuukkeli&gt;:http://google.com","pass":0},{"fail":1,"label":"t1","pass":0},{"fail":4,"label":"with space","pass":0},{"fail":1,"label":"with unicode \u5b98\u8bdd","pass":0}],[{"fail":4,"id":"s1","label":"Dir.Suite","name":"Dir.Suite","pass":2},{"fail":0,"id":"s1-s1","label":"Dir.Suite.Test.Suite.1","name":"Test.Suite.1","pass":1},{"fail":0,"id":"s1-s2","label":"Dir.Suite.Test.Suite.2","name":"Test.Suite.2","pass":1},{"fail":4,"id":"s1-s3","label":"Dir.Suite.Tests","name":"Tests","pass":0}]];
+window.output["generatedMillis"] = 28;
+window.output["baseMillis"] = 1325720367972;
window.settings = {"background":{"fail":"DeepPink"},"logURL":"log.html","reportURL":"report.html"};

Reply via email to