def test_js_generation_prunes_read_result(self): result = self._get_execution_result() results = Results(StubSettings(), 'output.xml') assert_equals(results._result, None) results._result = result # Fake reading results _ = results.js_result for test in result.suite.tests: assert_equals(len(test.keywords), 0)
def test_js_generation_prunes_read_result(self): result = self._get_execution_result() results = Results(StubSettings(), 'output.xml') assert_equal(results._result, None) results._result = result # Fake reading results _ = results.js_result for test in result.suite.tests: assert_equal(len(test.body), 0)
def create_jsdata(outxml, target): settings = RebotSettings({ 'name': '<Suite.Name>', 'critical': ['i?'], 'noncritical': ['*kek*kone*'], 'tagstatlink': [ 'force:http://google.com:<kuukkeli>', 'i*:http://%1/:Title of i%1', '?1:http://%1/:Title', '</script>:<url>:<title>' ], 'tagdoc': [ 'test:this_is_*my_bold*_test', 'IX:*Combined* and escaped << tag doc', 'i*:Me, myself, and I.', '</script>:<doc>' ], 'tagstatcombine': ['fooANDi*:No Match', 'i?:IX', '<*>:<any>'] }) result = Results(outxml, settings).js_result config = { 'logURL': 'log.html', 'minLevel': 'DEBUG', 'defaultLevel': 'DEBUG', 'reportURL': 'report.html', 'background': { 'fail': 'DeepPink' } } with utf8open(target, 'w') as output: writer = JsResultWriter(output, start_block='', end_block='') writer.write(result, config) print 'Log: ', normpath(join(BASEDIR, '..', 'rebot', 'log.html')) print 'Report: ', normpath(join(BASEDIR, '..', 'rebot', 'report.html'))
def create_jsdata(outxml, target): settings = RebotSettings({ 'name': '<Suite.Name>', 'critical': ['i?'], 'noncritical': ['*kek*kone*'], 'tagstatlink': ['force:http://google.com:<kuukkeli>', 'i*:http://%1/?foo=bar&zap=%1:Title of i%1', '?1:http://%1/<&>:Title', '</script>:<url>:<title>'], 'tagdoc': ['test:this_is_*my_bold*_test', 'IX:*Combined* and escaped << tag doc', 'i*:Me, myself, and I.', '</script>:<doc>'], 'tagstatcombine': ['fooANDi*:No Match', 'long1ORcollections', 'i?:IX', '<*>:<any>'] }) result = Results(settings, outxml).js_result config = {'logURL': 'log.html', 'title': 'This is a long long title. A very long title indeed. ' 'And it even contains some stuff to <esc&ape>. ' 'Yet it should still look good.', 'minLevel': 'DEBUG', 'defaultLevel': 'DEBUG', 'reportURL': 'report.html', 'background': {'fail': 'DeepPink'}} with open(target, 'wb') as output: writer = JsResultWriter(output, start_block='', end_block='') writer.write(result, config) print 'Log: ', normpath(join(BASEDIR, '..', 'rebot', 'log.html')) print 'Report: ', normpath(join(BASEDIR, '..', 'rebot', 'report.html'))
def report_html(self): """Return the test run log as HTML data (byte string), like it gets written to log.html files by robot. - Adapted from :meth:`robot.reporting.ReportWriter.write_results` """ settings = self.settings report_config = settings.report_config del report_config['logURL'] html = Buffer() self.writer._write_report( Results(settings, self.robot_result).js_result, html, report_config) html.seek(0) return html.read()
def create_jsdata(target, split_log, outxml=OUTPUT): result = Results(RebotSettings({'splitlog': split_log}), outxml).js_result config = { 'logURL': 'log.html', 'reportURL': 'report.html', 'background': { 'fail': 'DeepPink' } } with open(target, 'w') as output: JsResultWriter(output, start_block='', end_block='\n').write(result, config) writer = JsonWriter(output) for index, (keywords, strings) in enumerate(result.split_results): writer.write_json('window.outputKeywords%d = ' % index, keywords) writer.write_json('window.outputStrings%d = ' % index, strings)
def test_js_generation_does_not_prune_given_result(self): result = self._get_execution_result() results = Results(StubSettings(), result) _ = results.js_result for test in results.result.suite.tests: assert_true(len(test.body) > 0)
def __init__(self, result, settings): Results.__init__(self, None, settings) self._result = result if result: self.return_code = result.return_code