4 new revisions:
Revision: cfad06fb46fe
Author: Janne Härkönen <[email protected]>
Date: Thu Jun 16 02:18:37 2011
Log: matcher is space insensitive
http://code.google.com/p/robotframework/source/detail?r=cfad06fb46fe
Revision: 3001bd992d86
Author: Janne Härkönen <[email protected]>
Date: Thu Jun 16 02:19:32 2011
Log: write combine pattern to XML
http://code.google.com/p/robotframework/source/detail?r=3001bd992d86
Revision: f5aef3c05d96
Author: Janne Härkönen <[email protected]>
Date: Thu Jun 16 02:19:58 2011
Log: read combine pattern from json and use it to search tags
http://code.google.com/p/robotframework/source/detail?r=f5aef3c05d96
Revision: c444ddba978b
Author: Janne Härkönen <[email protected]>
Date: Thu Jun 16 02:20:08 2011
Log: Automated merge with https://robotframework.googlecode.com/hg/
http://code.google.com/p/robotframework/source/detail?r=c444ddba978b
==============================================================================
Revision: cfad06fb46fe
Author: Janne Härkönen <[email protected]>
Date: Thu Jun 16 02:18:37 2011
Log: matcher is space insensitive
http://code.google.com/p/robotframework/source/detail?r=cfad06fb46fe
Modified:
/src/robot/webcontent/util.js
=======================================
--- /src/robot/webcontent/util.js Wed Jun 15 13:26:33 2011
+++ /src/robot/webcontent/util.js Thu Jun 16 02:18:37 2011
@@ -46,7 +46,7 @@
}
function regexpEscape(string) {
- return string.replace(/[-[\]{}()+?*.,\\^$|#\s]/g, "\\$&");
+ return string.replace(/[-[\]{}()+?*.,\\^$|#]/g, "\\$&");
}
function Matcher(pattern) {
==============================================================================
Revision: 3001bd992d86
Author: Janne Härkönen <[email protected]>
Date: Thu Jun 16 02:19:32 2011
Log: write combine pattern to XML
http://code.google.com/p/robotframework/source/detail?r=3001bd992d86
Modified:
/src/robot/common/statistics.py
/src/robot/output/xmllogger.py
/src/robot/result/elementhandlers.py
=======================================
--- /src/robot/common/statistics.py Wed Jun 15 04:01:03 2011
+++ /src/robot/common/statistics.py Thu Jun 16 02:19:32 2011
@@ -92,14 +92,15 @@
class TagStat(Stat):
type = 'tag'
- def __init__(self, name, critical=False, non_critical=False,
info=None):
+ def __init__(self, name, critical=False, non_critical=False, info=None,
+ combined=''):
doc = info.get_doc(name) if info else ''
Stat.__init__(self, name, doc, link=name)
self.critical = critical
self.non_critical = non_critical
- self.combined = False
self.tests = []
self.links = info.get_links(name) if info else []
+ self.combined = combined
def add_test(self, test):
Stat.add_test(self, test)
@@ -107,24 +108,17 @@
def __cmp__(self, other):
if self.critical != other.critical:
- return self.critical is True and -1 or 1
+ return cmp(self.critical, other.critical)
if self.non_critical != other.non_critical:
- return self.non_critical is True and -1 or 1
- if self.combined != other.combined:
- return self.combined is True and -1 or 1
+ return cmp(self.non_critical, other.non_critical)
+ if bool(self.combined) != bool(other.combined):
+ return cmp(bool(self.combined), bool(other.combined))
return cmp(self.name, other.name)
def serialize(self, serializer):
serializer.tag_stat(self)
-class CombinedTagStat(TagStat):
-
- def __init__(self, name):
- TagStat.__init__(self, name)
- self.combined = True
-
-
class TotalStat(Stat):
type = 'total'
@@ -216,7 +210,7 @@
for tag in test.tags:
if not self._is_included(tag):
continue
- if not self.stats.has_key(tag):
+ if tag not in self.stats:
self.stats[tag] = TagStat(tag, critical.is_critical(tag),
critical.is_non_critical(tag),
self._taginfo)
@@ -229,8 +223,8 @@
def _add_tagstatcombine_statistics(self, test):
for pattern, name in self._patterns_and_names:
- if not self.stats.has_key(name):
- self.stats[name] = CombinedTagStat(name)
+ if name not in self.stats:
+ self.stats[name] = TagStat(name, combined=pattern)
if test.is_included([pattern], []):
self.stats[name].add_test(test)
=======================================
--- /src/robot/output/xmllogger.py Wed Jun 15 04:01:03 2011
+++ /src/robot/output/xmllogger.py Thu Jun 16 02:19:32 2011
@@ -144,7 +144,8 @@
def tag_stat(self, stat):
self._stat(stat, attrs={'info': self._get_tag_stat_info(stat),
- 'links': self._get_tag_links(stat)})
+ 'links': self._get_tag_links(stat),
+ 'combined': stat.combined})
def _get_tag_links(self, stat):
return ':::'.join(':'.join([title, url]) for url, title in
stat.links)
@@ -158,11 +159,11 @@
self._writer.element('stat', name, attrs)
def _get_tag_stat_info(self, stat):
- if stat.critical is True:
+ if stat.critical:
return 'critical'
- if stat.non_critical is True:
+ if stat.non_critical:
return 'non-critical'
- if stat.combined is True:
+ if stat.combined:
return 'combined'
return ''
=======================================
--- /src/robot/result/elementhandlers.py Wed Jun 15 22:34:30 2011
+++ /src/robot/result/elementhandlers.py Thu Jun 16 02:19:32 2011
@@ -141,12 +141,14 @@
_Handler.__init__(self, context, attrs)
self._pass = int(attrs.getValue('pass'))
self._fail = int(attrs.getValue('fail'))
- self._doc = attrs.get('doc') or ''
- self._info = attrs.get('info') or ''
- self._links = attrs.get('links') or ''
+ self._doc = attrs.get('doc', '')
+ self._info = attrs.get('info', '')
+ self._links = attrs.get('links', '')
+ self._pattern = attrs.get('combined', '')
def end_element(self, text):
- return [text, self._pass, self._fail, self._doc, self._info,
self._links]
+ return [text, self._pass, self._fail, self._doc, self._info,
+ self._links, self._pattern]
class _StatusHandler(object):
==============================================================================
Revision: f5aef3c05d96
Author: Janne Härkönen <[email protected]>
Date: Thu Jun 16 02:19:58 2011
Log: read combine pattern from json and use it to search tags
http://code.google.com/p/robotframework/source/detail?r=f5aef3c05d96
Modified:
/src/robot/webcontent/model.js
/utest/webcontent/spec/ContainsTag.js
=======================================
--- /src/robot/webcontent/model.js Wed Jun 15 14:32:15 2011
+++ /src/robot/webcontent/model.js Thu Jun 16 02:19:58 2011
@@ -41,7 +41,9 @@
};
suite.searchTestsByTag = function (tag) {
return suite.searchTests(function (test) {
- return containsTag(test.tags, tag.label, tag.info
== 'combined');
+ if (tag.pattern)
+ return containsTagPattern(test.tags, tag.pattern);
+ return containsTag(test.tags, tag.label);
});
};
suite.findSuiteByName = function (name) {
@@ -60,26 +62,29 @@
return suite;
}
- function containsTag(testTags, tagname, isCombined) {
+ function containsTag(testTags, tagname) {
testTags = util.map(testTags, util.normalize);
- if (!isCombined)
- return util.contains(testTags, util.normalize(tagname));
- if (tagname.indexOf(' & ') != -1) {
- var tagnames = tagname.split(' & ');
+ return util.contains(testTags, util.normalize(tagname));
+ }
+
+ function containsTagPattern(testTags, pattern) {
+ testTags = util.map(testTags, util.normalize);
+ if (pattern.indexOf('&') != -1) {
+ var tagnames = pattern.split('&');
return util.all(util.map(tagnames, function (name) {
- return containsTag(testTags, name, true);
+ return containsTagPattern(testTags, name);
}));
}
- if (tagname.indexOf(' NOT ') != -1) {
- var tagnames = tagname.split(' NOT ');
+ if (pattern.indexOf('NOT') != -1) {
+ var tagnames = pattern.split('NOT');
var required = tagnames[0];
var notAllowed = tagnames.slice(1);
- return containsTag(testTags, required, true) &&
+ return containsTagPattern(testTags, required) &&
util.all(util.map(notAllowed, function (name) {
- return !containsTag(testTags, name, true);
- }))
- }
- var matcher = util.Matcher(tagname)
+ return !containsTagPattern(testTags, name);
+ }));
+ }
+ var matcher = util.Matcher(pattern);
return util.any(util.map(testTags, matcher.matches));
}
@@ -300,6 +305,7 @@
NOT_RUN: STATUS.notRun,
formatElapsed: formatElapsed,
containsTag: containsTag, // Exposed for tests
+ containsTagPattern: containsTagPattern, // Exposed for tests
shortTime: shortTime
};
}();
@@ -338,6 +344,7 @@
else
stat.shownInfo = '';
stat.links = parseLinks(data[5]);
+ stat.pattern = data[6];
return stat;
}
=======================================
--- /utest/webcontent/spec/ContainsTag.js Mon Jun 13 03:49:40 2011
+++ /utest/webcontent/spec/ContainsTag.js Thu Jun 16 02:19:58 2011
@@ -15,33 +15,33 @@
});
it("should find tags combined with &", function() {
- expect(model.containsTag(['x', 'y'], 'x & y', true)).toBeTruthy();
- expect(model.containsTag(['xx', 'Yy', 'ZZ'], 'Y Y & X X & zz',
true)).toBeTruthy();
- expect(model.containsTag(['x', 'y'], 'xx & y',
true)).not.toBeTruthy();
+ expect(model.containsTagPattern(['x', 'y'], 'x&y')).toBeTruthy();
+ expect(model.containsTagPattern(['xx', 'Yy', 'ZZ'], 'Y Y & X X &
zz')).toBeTruthy();
+
expect(model.containsTagPattern(['x', 'y'], 'xx&y')).not.toBeTruthy();
});
it("should find tags combined with NOT", function() {
- expect(model.containsTag(['x', 'y'], 'x NOT z',
true)).toBeTruthy();
- expect(model.containsTag(['xx', 'yy'], 'X X NOT y NOT zz',
true)).toBeTruthy();
- expect(model.containsTag(['X X', 'Y Y'], 'xx NOT yy',
true)).not.toBeTruthy();
+ expect(model.containsTagPattern(['x', 'y'], 'xNOTz')).toBeTruthy();
+ expect(model.containsTagPattern(['xx', 'yy'], 'X X NOT y NOT
zz')).toBeTruthy();
+ expect(model.containsTagPattern(['X X', 'Y
Y'], 'xxNOTyy')).not.toBeTruthy();
});
it("should find tags combined with patterns (* and ?)", function() {
- expect(model.containsTag(['x', 'y'], 'x*', true)).toBeTruthy();
- expect(model.containsTag(['xxxyyy'], 'x*', true)).toBeTruthy();
- expect(model.containsTag(['xyz'], 'x?z', true)).toBeTruthy();
- expect(model.containsTag(['-x-'], '*x*', true)).toBeTruthy();
- expect(model.containsTag(['x', 'y'], 'x', true)).toBeTruthy();
+ expect(model.containsTagPattern(['x', 'y'], 'x*')).toBeTruthy();
+ expect(model.containsTagPattern(['xxxyyy'], 'x*')).toBeTruthy();
+ expect(model.containsTagPattern(['xyz'], 'x?z')).toBeTruthy();
+ expect(model.containsTagPattern(['-x-'], '*x*')).toBeTruthy();
+ expect(model.containsTagPattern(['x', 'y'], 'x')).toBeTruthy();
});
it("should find tags combined with patterns and & and NOT", function()
{
- expect(model.containsTag(['xx', 'yy'], 'x* & y?',
true)).toBeTruthy();
- expect(model.containsTag(['xxxyyy'], 'x* NOT y',
true)).toBeTruthy();
- expect(model.containsTag(['xxxyyy'], 'x* NOT *y',
true)).not.toBeTruthy();
+ expect(model.containsTagPattern(['xx', 'yy'], 'x* &
y?')).toBeTruthy();
+ expect(model.containsTagPattern(['xxxyyy'], 'x* NOT
y')).toBeTruthy();
+ expect(model.containsTagPattern(['xxxyyy'], 'x* NOT
*y')).not.toBeTruthy();
});
it("should esacpe regex metacharacters in patterns", function() {
- expect(model.containsTag(['xyz'], 'x.*', true)).not.toBeTruthy();
- expect(model.containsTag(['x.z'], 'x.*', true)).toBeTruthy();
+ expect(model.containsTagPattern(['xyz'], 'x.*')).not.toBeTruthy();
+ expect(model.containsTagPattern(['x.z'], 'x.*')).toBeTruthy();
});
});
==============================================================================
Revision: c444ddba978b
Author: Janne Härkönen <[email protected]>
Date: Thu Jun 16 02:20:08 2011
Log: Automated merge with https://robotframework.googlecode.com/hg/
http://code.google.com/p/robotframework/source/detail?r=c444ddba978b
Modified:
/src/robot/webcontent/model.js
=======================================
--- /src/robot/webcontent/model.js Thu Jun 16 01:58:49 2011
+++ /src/robot/webcontent/model.js Thu Jun 16 02:20:08 2011
@@ -41,7 +41,9 @@
};
suite.searchTestsByTag = function (tag) {
return suite.searchTests(function (test) {
- return containsTag(test.tags, tag.label, tag.info
== 'combined');
+ if (tag.pattern)
+ return containsTagPattern(test.tags, tag.pattern);
+ return containsTag(test.tags, tag.label);
});
};
suite.findSuiteByName = function (name) {
@@ -60,26 +62,29 @@
return suite;
}
- function containsTag(testTags, tagname, isCombined) {
+ function containsTag(testTags, tagname) {
testTags = util.map(testTags, util.normalize);
- if (!isCombined)
- return util.contains(testTags, util.normalize(tagname));
- if (tagname.indexOf(' & ') != -1) {
- var tagnames = tagname.split(' & ');
+ return util.contains(testTags, util.normalize(tagname));
+ }
+
+ function containsTagPattern(testTags, pattern) {
+ testTags = util.map(testTags, util.normalize);
+ if (pattern.indexOf('&') != -1) {
+ var tagnames = pattern.split('&');
return util.all(util.map(tagnames, function (name) {
- return containsTag(testTags, name, true);
+ return containsTagPattern(testTags, name);
}));
}
- if (tagname.indexOf(' NOT ') != -1) {
- var tagnames = tagname.split(' NOT ');
+ if (pattern.indexOf('NOT') != -1) {
+ var tagnames = pattern.split('NOT');
var required = tagnames[0];
var notAllowed = tagnames.slice(1);
- return containsTag(testTags, required, true) &&
+ return containsTagPattern(testTags, required) &&
util.all(util.map(notAllowed, function (name) {
- return !containsTag(testTags, name, true);
- }))
- }
- var matcher = util.Matcher(tagname)
+ return !containsTagPattern(testTags, name);
+ }));
+ }
+ var matcher = util.Matcher(pattern);
return util.any(util.map(testTags, matcher.matches));
}
@@ -300,6 +305,7 @@
NOT_RUN: STATUS.notRun,
formatElapsed: formatElapsed,
containsTag: containsTag, // Exposed for tests
+ containsTagPattern: containsTagPattern, // Exposed for tests
shortTime: shortTime
};
}();
@@ -338,6 +344,7 @@
else
stat.shownInfo = '';
stat.links = parseLinks(data[5]);
+ stat.pattern = data[6];
return stat;
}