Revision: f0fb2475dd41
Branch:   report-improvements
Author:   Janne Piironen <janne.piiro...@gmail.com>
Date:     Sun Jan 26 03:58:58 2014 UTC
Log:      implemented basic pattern search for tag and suites
http://code.google.com/p/robotframework/source/detail?r=f0fb2475dd41

Modified:
 /src/robot/htmldata/rebot/model.js
 /src/robot/htmldata/rebot/report.css
 /src/robot/htmldata/rebot/report.html

=======================================
--- /src/robot/htmldata/rebot/model.js  Fri Feb 15 09:25:40 2013 UTC
+++ /src/robot/htmldata/rebot/model.js  Sun Jan 26 03:58:58 2014 UTC
@@ -33,6 +33,9 @@
         suite.findSuiteByName = function (name) {
             return findSuiteByName(suite, name);
         };
+        suite.findSuiteByPattern = function (pattern) {
+            return findSuiteByPattern(suite, pattern);
+        };
         suite.allTests = function () {
             return suite.searchTests(function (test) {
                 return true;
@@ -82,6 +85,18 @@
         }
         return null;
     }
+
+     function findSuiteByPattern(suite, pattern) {
+        if (util.Matcher(pattern).matches(suite.fullName.toLowerCase()))
+            return suite;
+        var subSuites = suite.suites();
+        for (var i in subSuites) {
+            var match = findSuiteByPattern(subSuites[i], pattern);
+            if (match)
+                return match;
+        }
+        return null;
+    }

     function setStats(suite, stats) {
         for (var name in stats) {
=======================================
--- /src/robot/htmldata/rebot/report.css        Mon Feb 18 13:50:21 2013 UTC
+++ /src/robot/htmldata/rebot/report.css        Sun Jan 26 03:58:58 2014 UTC
@@ -37,6 +37,9 @@
 #print-selector {
     display: none;
 }
+#print-search {
+    display: none;
+}
 /* Tabs - adapted from http://www.htmldog.com/articles/tabs */
 #detail-tabs {
     list-style: none;
=======================================
--- /src/robot/htmldata/rebot/report.html       Sat Oct 12 17:33:44 2013 UTC
+++ /src/robot/htmldata/rebot/report.html       Sun Jan 26 03:58:58 2014 UTC
@@ -172,6 +172,9 @@
var tag = util.filter(window.testdata.statistics().tag, function (tag) {
         return tag.label == name;
     })[0];
+    if (!tag) {
+        tag = {'combined': name};
+    }
     renderTagDetails(tag);
     updatePrintSelector(name, tag.info);
     scrollToSelector('tag_'+name);
@@ -186,8 +189,23 @@

 function renderTagDetails(tag) {
     var tests = getTestsHavingTag(tag);
-    if (tag)
+    if (tag) {
         tag.totalTime = calculateTotalTime(tests);
+        if (!tag.label){
+            if (tests.length > 0) {
+                tag.total = tests.length;
+                tag.pass = calculatePassed(tests, false);
+                tag.fail = tag.total - tag.pass;
+            } else {
+                tag.total = 0;
+                tag.pass = 0;
+                tag.fail = 0;
+            }
+        }
+        tag.critical = calculateCritical(tests);
+        tag.criticalPassed = calculatePassed(tests, true);
+        tag.criticalFailed = tag.critical - tag.criticalPassed;
+    }
     $.tmpl('tagOrTotalDetailsTemplate', tag).appendTo('#details-header');
     drawTestDetailsTable(tests, true);
 }
@@ -210,6 +228,9 @@
 function renderSuiteDetails(id) {
     window.testdata.ensureLoaded(id, function (ids) {
         var suite = window.testdata.findLoaded(id);
+        if (!suite) {
+            suite = window.testdata.suite().findSuiteByPattern(id)
+        }
         var opts = {logURL: window.settings.logURL};
$.tmpl('suiteDetailsTemplate', suite, opts).appendTo('#details-header');
         drawTestDetailsTable(suite.allTests(), false);
@@ -255,7 +276,8 @@
 function getTestsHavingTag(tag) {
     if (!tag)
         return [];
- return window.testdata.suite().searchTestsByTag(tag).sort(sortByStatus); + var tests = window.testdata.suite().searchTestsByTag(tag).sort(sortByStatus);
+    return tests;
 }

 function getTotalTests(name) {
@@ -270,6 +292,26 @@
         total += tests[i].times.elapsedMillis;
     return util.formatElapsed(total);
 }
+
+function calculatePassed(tests, isCritical) {
+    var total = 0;
+    for (var i = 0, len = tests.length; i < len; i++) {
+        if (tests[i].status === 'PASS') {
+            if (!isCritical || tests[i].isCritical)
+                    total++;
+        }
+    }
+    return total;
+}
+
+function calculateCritical(tests) {
+    var total = 0;
+    for (var i = 0, len = tests.length; i < len; i++) {
+        if(tests[i].isCritical)
+            total++;
+    }
+    return total;
+}

 function renderTestDetails(sortByStatus, target) {
     if (!window.elementsToRender.length)
@@ -473,6 +515,16 @@
       </td>
       <td id="print-selector"></td>
     </tr>
+    <tr id="search">
+      <th>Search pattern:</th>
+      <td id="normal-search">
+        <form>
+          <input id="search-field" type="text" value="${selected}">
+ <input type="submit" value="Search" onclick="tagDetailSelected($('#search-field').val())">
+        </form>
+      </td>
+      <td id="print-search"></td>
+    </tr>
   </table>
 </script>

@@ -494,13 +546,26 @@
       </td>
       <td id="print-selector"></td>
     </tr>
+    <tr id="search">
+      <th>Search pattern:</th>
+      <td id="normal-search">
+        <form>
+          <input id="search-field" type="text" value="${selected}">
+ <input type="submit" value="Search" onclick="suiteDetailSelected($('#search-field').val())">
+        </form>
+      </td>
+      <td id="print-search"></td>
+    </tr>
   </table>
 </script>

 <script type="text/x-jquery-tmpl" id="tagOrTotalDetailsTemplate">
   <tr>
     <th>Status:</th>
- <td>${total} total, ${pass} passed, {{if fail}}<span class="fail">${fail} failed</span>{{else}}<span class="pass">0 failed</span>{{/if}}</td>
+    <td>
+ ${critical} critical test, ${criticalPassed} passed, <span class="{{if criticalFailed}}fail{{else}}pass{{/if}}">${criticalFailed} failed</span><br> + ${total} total, ${pass} passed, {{if fail}}<span class="fail">${fail} failed</span>{{else}}<span class="pass">0 failed</span>{{/if}}
+    </td>
   </tr>
   {{if doc}}
   <tr>

--

--- You received this message because you are subscribed to the Google Groups "robotframework-commit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to robotframework-commit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to