4 new revisions:
Revision: f3dd95e6b028
Author: Janne Härkönen <[email protected]>
Date: Wed Jun 15 00:49:32 2011
Log: Unfortunately, the order of CSS imports matters
http://code.google.com/p/robotframework/source/detail?r=f3dd95e6b028
Revision: 7e1ba3751250
Author: Janne Härkönen <[email protected]>
Date: Wed Jun 15 01:09:45 2011
Log: refactored the way output files are built
http://code.google.com/p/robotframework/source/detail?r=7e1ba3751250
Revision: 4264c035c23a
Author: Janne Härkönen <[email protected]>
Date: Wed Jun 15 01:12:19 2011
Log: merge
http://code.google.com/p/robotframework/source/detail?r=4264c035c23a
Revision: c300020035ec
Author: Janne Härkönen <[email protected]>
Date: Wed Jun 15 01:12:34 2011
Log: Automated merge with https://robotframework.googlecode.com/hg/
http://code.google.com/p/robotframework/source/detail?r=c300020035ec
==============================================================================
Revision: f3dd95e6b028
Author: Janne Härkönen <[email protected]>
Date: Wed Jun 15 00:49:32 2011
Log: Unfortunately, the order of CSS imports matters
http://code.google.com/p/robotframework/source/detail?r=f3dd95e6b028
Modified:
/src/robot/webcontent/report.html
=======================================
--- /src/robot/webcontent/report.html Tue Jun 14 23:23:59 2011
+++ /src/robot/webcontent/report.html Wed Jun 15 00:49:32 2011
@@ -6,8 +6,8 @@
<META HTTP-EQUIV="Expires" CONTENT="-1">
<!-- BEGIN SCRIPTS -->
-<link rel="stylesheet" type="text/css" href="report.css" media="all"/>
<link rel="stylesheet" type="text/css" href="common.css" media="all"/>
+<link rel="stylesheet" type="text/css" href="report.css" media="all"/>
<link rel="stylesheet" type="text/css" href="print.css" media="print"/>
<script type="text/javascript" src="lib/jquery.min.js"></script>
<script type="text/javascript" src="lib/jquery.tmpl.min.js"></script>
==============================================================================
Revision: 7e1ba3751250
Author: Janne Härkönen <[email protected]>
Date: Wed Jun 15 01:09:45 2011
Log: refactored the way output files are built
http://code.google.com/p/robotframework/source/detail?r=7e1ba3751250
Modified:
/src/robot/serializing/serialize_log.py
/src/robot/serializing/testoutput.py
/src/robot/webcontent/log.html
/src/robot/webcontent/report.html
=======================================
--- /src/robot/serializing/serialize_log.py Tue Jun 14 23:23:59 2011
+++ /src/robot/serializing/serialize_log.py Wed Jun 15 01:09:45 2011
@@ -20,117 +20,71 @@
import robot
from robot import utils
-PATH = os.path.join(os.path.dirname(robot.__file__),'webcontent')
-LOG_TEMPLATE = os.path.join(PATH,'log.html')
-REPORT_TEMPLATE = os.path.join(PATH, 'report.html')
+BASEPATH = os.path.join(os.path.dirname(robot.__file__), 'webcontent')
+LOG_TEMPLATE = os.path.join(BASEPATH,'log.html')
+REPORT_TEMPLATE = os.path.join(BASEPATH, 'report.html')
JS_FILE_REGEXP = re.compile('src=\"([^\"]+)\"')
CSS_FILE_REGEXP = re.compile('href=\"([^\"]+)\"')
CSS_MEDIA_TYPE_REGEXP = re.compile('media=\"([^\"]+)\"')
-def serialize_log(test_output_datamodel, log_path, title=None):
+
+def serialize_log(output, log_path, title=None):
if log_path is None:
return
- _build_file(log_path, test_output_datamodel, title, None, LOG_TEMPLATE)
-
-def serialize_report(test_output_datamodel, report_path, title=None,
background=None, log_path=None):
+ _build_file(log_path, output, title, LOG_TEMPLATE)
+
+def serialize_report(output, report_path, title=None, log_path=None):
if report_path is None:
return
- relative_log_path = _build_relative_log_path(report_path, log_path)
- _build_file(report_path, test_output_datamodel, title,
_resolve_background_colors(background), REPORT_TEMPLATE, relative_log_path)
-
-def _build_relative_log_path(report, log):
+ _build_file(report_path, output, title, REPORT_TEMPLATE,
+ _relative_log_path(report_path, log_path))
+
+def _relative_log_path(report, log):
if not log:
return None
return utils.get_link_path(log, os.path.dirname(report))
-def _build_file(outpath, test_output_datamodel, title, background,
template, log_path=None):
+def _build_file(outpath, output, title, template, log_path=None):
with codecs.open(outpath, 'w', encoding='UTF-8') as outfile:
- populator = _Populator(outfile, test_output_datamodel, title,
background, log_path)
- with open(template, 'r') as templ:
- for line in templ:
- populator.line(line)
-
-def _resolve_background_colors(color_str):
- if color_str and color_str.count(':') not in [1, 2]:
- #LOGGER.error("Invalid background color '%s'." % color_str)
- color_str = None
- if not color_str:
- color_str = '#99FF66:#FF3333'
- colors = color_str.split(':', 2)
- return colors if len(colors) == 3 else [colors[0], colors[0],
colors[1]]
-
-
-class _Populator(object):
-
- def __init__(self, log, test_output_datamodel, title, background,
log_path=None):
- self._log = log
- self._log_path=log_path
- self._test_output_datamodel = test_output_datamodel
+ builder = OutputFileBuilder(outfile, output, title, log_path)
+ with open(template, 'r') as tmpl:
+ for line in tmpl:
+ builder.line(line)
+
+
+class OutputFileBuilder(object):
+
+ def __init__(self, outfile, output, title, log_path=None):
+ self._outfile = outfile
+ self._log_path = log_path
+ self._output = output
self._title = title
- self._parsing = self._normal_parsing
- self._backgrounds = {"/* BACKGROUND: critical pass */":
background[0] if background else None,
- "/* BACKGROUND: non critical fail */":
background[1] if background else None,
- "/* BACKGROUND: critical fail */":
background[2] if background else None}
def line(self, line):
- self._parsing(line)
-
- def _normal_parsing(self, line):
- if self._is_begin_scripts(line):
- self._start_script()
- elif self._is_title_line_to_handle(line):
+ if self._is_title_line_to_handle(line):
self._write_title()
- elif self._is_background_line_to_handle(line):
- self._write_background(line)
elif self._is_log_path_line_to_handle(line):
self._replace_log_path(line)
+ elif self._is_output_js(line):
+ self._write_output_js()
+ elif self._is_css_line(line):
+ self._write_lines_css(line)
+ elif self._is_js_line(line):
+ self._write_lines_js(line)
else:
- self._log.write(line)
-
- def _is_begin_scripts(self, line):
- return line == '<!-- BEGIN SCRIPTS -->\n'
-
- def _start_script(self):
- self._parsing = self._in_script
+ self._outfile.write(line)
def _is_title_line_to_handle(self, line):
return self._title is not None and line.startswith('<title>')
def _write_title(self):
- self._log.write('<title>%s</title>\n' % self._title)
-
- def _is_background_line_to_handle(self, line):
- for marker in self._backgrounds:
- if marker in line:
- return True
- return False
-
- def _write_background(self, line):
- for marker in self._backgrounds:
- if marker in line:
- self._log.write(" background: %s;\n" %
self._backgrounds[marker])
+ self._outfile.write('<title>%s</title>\n' % self._title)
def _is_log_path_line_to_handle(self, line):
return self._log_path and 'log.html' in line
def _replace_log_path(self, line):
- self._log.write(line.replace('log.html', self._log_path))
-
- def _in_script(self, line):
- if self._is_end_scripts(line):
- self._end_script()
- elif self._is_output_js(line):
- self._write_output_js()
- elif self._is_css_line(line):
- self._write_lines_css(line)
- else:
- self._write_lines_js(line)
-
- def _is_end_scripts(self, line):
- return line == '<!-- END SCRIPTS -->\n'
-
- def _end_script(self):
- self._parsing = self._normal_parsing
+ self._outfile.write(line.replace('log.html', self._log_path))
def _is_output_js(self, line):
return line.startswith('<!-- OUTPUT JS -->')
@@ -138,38 +92,36 @@
def _is_css_line(self, line):
return line.startswith('<link rel')
+ def _is_js_line(self, line):
+ return line.startswith('<script type="text/javascript" src=')
+
def _write_output_js(self):
- self._log.write('<script type="text/javascript">\n')
- self._test_output_datamodel.write_to(self._log)
- self._log.write('</script>\n\n')
+ self._outfile.write('<script type="text/javascript">\n')
+ self._output.write_to(self._outfile)
+ self._outfile.write('</script>\n\n')
def _write_lines_css(self, line):
- self._log.write('<style type="text/css" media="%s">\n' %
self._parse_css_media_type(line))
- self._write_from_file(self._parse_css_file_name(line))
- self._log.write('</style>\n\n')
+ self._outfile.write('<style type="text/css" media="%s">\n'
+ % self._parse_css_media_type(line))
+ self._write_from_file(self._parse_file_name(line, CSS_FILE_REGEXP))
+ self._outfile.write('</style>\n\n')
def _parse_css_media_type(self, line):
return CSS_MEDIA_TYPE_REGEXP.search(line).group(1)
def _write_lines_js(self, line):
- self._log.write('<script type="text/javascript">\n')
- self._write_from_file(self._parse_js_file_name(line))
- self._log.write('</script>\n\n')
-
- def _parse_js_file_name(self, line):
- return os.path.join(PATH,
JS_FILE_REGEXP.search(line).group(1).replace('/', os.path.sep))
-
- def _parse_css_file_name(self, line):
- return os.path.join(PATH,
CSS_FILE_REGEXP.search(line).group(1).replace('/', os.path.sep))
+ self._outfile.write('<script type="text/javascript">\n')
+ self._write_from_file(self._parse_file_name(line, JS_FILE_REGEXP))
+ self._outfile.write('</script>\n\n')
+
+ def _parse_file_name(self, line, filename_regexp):
+ return self._relative_path(filename_regexp.search(line).group(1))
+
+ def _relative_path(self, filename):
+ return os.path.join(BASEPATH, filename.replace('/', os.path.sep))
def _write_from_file(self, source):
with codecs.open(source, 'r', encoding='UTF-8') as content:
for line in content:
- self._log.write(line)
- self._log.write('\n')
-
-
-if __name__ == '__main__':
- import jsparser
- jsparser.parse('output.xml', 'output.js')
- serialize_log('output.js', 'logjsx.html')
+ self._outfile.write(line)
+ self._outfile.write('\n')
=======================================
--- /src/robot/serializing/testoutput.py Tue Jun 14 22:30:07 2011
+++ /src/robot/serializing/testoutput.py Wed Jun 15 01:09:45 2011
@@ -43,7 +43,7 @@
def _make_report(self, report_path, log_path, data_model, settings):
if report_path:
- serialize_report(data_model, report_path,
settings['ReportTitle'], settings['ReportBackground'], log_path)
+ serialize_report(data_model, report_path,
settings['ReportTitle'], log_path)
LOGGER.output_file('Report', report_path)
def _make_log(self, log_path, data_model, settings):
@@ -113,7 +113,7 @@
self.serialize_summary(settings['Summary'],
settings['SummaryTitle'],
settings['ReportBackground'])
datamodel = jsparser.create_datamodel_from(output)
- serialize_report(datamodel, settings['Report'],
settings['ReportTitle'], settings['ReportBackground'], settings['Log'])
+ serialize_report(datamodel, settings['Report'],
settings['ReportTitle'], settings['Log'])
LOGGER.output_file('Report', settings['Report'])
serialize_log(datamodel, settings['Log'], settings['LogTitle'])
LOGGER.output_file('Log', settings['Log'])
=======================================
--- /src/robot/webcontent/log.html Tue Jun 14 23:23:59 2011
+++ /src/robot/webcontent/log.html Wed Jun 15 01:09:45 2011
@@ -5,7 +5,6 @@
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
-<!-- BEGIN SCRIPTS -->
<link rel="stylesheet" type="text/css" href="log.css" media="all"/>
<link rel="stylesheet" type="text/css" href="common.css" media="all"/>
<link rel="stylesheet" type="text/css" href="print.css" media="print"/>
@@ -18,7 +17,6 @@
<script type="text/javascript" src="util.js"></script>
<script type="text/javascript" src="testdata.js"></script>
<script type="text/javascript" src="stats.js"></script>
-<!-- END SCRIPTS -->
<title>[SUITE_NAME] Test Log</title>
</head>
=======================================
--- /src/robot/webcontent/report.html Wed Jun 15 00:49:32 2011
+++ /src/robot/webcontent/report.html Wed Jun 15 01:09:45 2011
@@ -5,7 +5,6 @@
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
-<!-- BEGIN SCRIPTS -->
<link rel="stylesheet" type="text/css" href="common.css" media="all"/>
<link rel="stylesheet" type="text/css" href="report.css" media="all"/>
<link rel="stylesheet" type="text/css" href="print.css" media="print"/>
@@ -17,7 +16,6 @@
<script type="text/javascript" src="util.js"></script>
<script type="text/javascript" src="testdata.js"></script>
<script type="text/javascript" src="stats.js"></script>
-<!-- END SCRIPTS -->
<title>[SUITE_NAME] Test Report</title>
</head>
==============================================================================
Revision: 4264c035c23a
Author: Janne Härkönen <[email protected]>
Date: Wed Jun 15 01:12:19 2011
Log: merge
http://code.google.com/p/robotframework/source/detail?r=4264c035c23a
Modified:
/src/robot/serializing/testoutput.py
=======================================
--- /src/robot/serializing/testoutput.py Wed Jun 15 01:09:45 2011
+++ /src/robot/serializing/testoutput.py Wed Jun 15 01:12:19 2011
@@ -11,9 +11,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+
import os
import tempfile
-
import time
from robot import utils
@@ -51,9 +51,9 @@
serialize_log(data_model, log_path, settings['LogTitle'])
LOGGER.output_file('Log', log_path)
- def _make_xunit(self, xunit_path, data_sources, settings):
+ def _make_xunit(self, xunit_path, data_source, settings):
if xunit_path:
- self._robot_test_output(data_sources,
settings).serialize_xunit(xunit_path)
+ self._robot_test_output([data_source],
settings).serialize_xunit(xunit_path)
def _robot_test_output(self, data_sources, settings):
if self._robot_test_output_cached is None:
@@ -80,6 +80,7 @@
def execute(self, settings, data_source):
data_model = jsparser.create_datamodel_from(data_source)
+ data_model.set_generated(time.localtime())
log_path = self._parse_file(settings['Log'])
report_path = self._parse_file(settings['Report'])
self._make_log(log_path, data_model, settings)
==============================================================================
Revision: c300020035ec
Author: Janne Härkönen <[email protected]>
Date: Wed Jun 15 01:12:34 2011
Log: Automated merge with https://robotframework.googlecode.com/hg/
http://code.google.com/p/robotframework/source/detail?r=c300020035ec
Modified:
/src/robot/webcontent/log.html
=======================================
--- /src/robot/webcontent/log.html Wed Jun 15 01:11:27 2011
+++ /src/robot/webcontent/log.html Wed Jun 15 01:12:34 2011
@@ -5,7 +5,6 @@
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
-<!-- BEGIN SCRIPTS -->
<link rel="stylesheet" type="text/css" href="log.css" media="all"/>
<link rel="stylesheet" type="text/css" href="common.css" media="all"/>
<link rel="stylesheet" type="text/css" href="print.css" media="print"/>
@@ -18,7 +17,6 @@
<script type="text/javascript" src="util.js"></script>
<script type="text/javascript" src="testdata.js"></script>
<script type="text/javascript" src="stats.js"></script>
-<!-- END SCRIPTS -->
<title>[SUITE_NAME] Test Log</title>
</head>