]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-4093 Add test information
authorJulien Lancelot <julien.lancelot@gmail.com>
Wed, 6 Feb 2013 07:39:47 +0000 (08:39 +0100)
committerJulien Lancelot <julien.lancelot@gmail.com>
Wed, 6 Feb 2013 07:40:02 +0000 (08:40 +0100)
plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/web/tests_viewer.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/test/_testable_working_view.erb

index 47f5aac6a9190ad06086b68330c4181789ec4ba7..1daa013ee803bab0bf9ce55788f3dd43af482be2 100644 (file)
@@ -89,7 +89,7 @@
     <%
        test_cases.each_with_index do |test_case, index|
     %>
-      <tr class="<%= cycle("even", "odd") -%>" id="testdata_<%= index -%>" display="table-row">
+      <tr class="<%= cycle("even", "odd") -%> testdata_<%= index -%>" display="table-row">
         <%
            status = test_case[:status]
            case status
              else
                icon_url = ApplicationController.root_context + "/images/levels/" + status + ".png"
            end
-
         %>
         <td class="thin" nowrap>
-          <img id="test_status_<%= index -%>_<%= status -%>" src="<%= icon_url -%>"/>
+          <img class="test_status_<%= index -%>_<%= status -%>" src="<%= icon_url -%>"/>
         </td>
-        <td id="test_time_<%= index -%>" class="thin right" nowrap><%= test_case[:time] -%> ms</td>
+        <td class="test_time_<%= index -%> thin right" nowrap><%= test_case[:time] -%> ms</td>
         <% if has_covered_lines %>
-          <td id="test_covered_lines_<%= index -%>" class="thin right" nowrap>
+          <td class="test_covered_lines_<%= index -%>" class="thin right" nowrap>
             <a class="test_covered_lines_link_<%= index -%>" href="<%= ApplicationController.root_context -%>/test/testcase/?sid=<%= @snapshot.id -%>&test=<%= test_case[:name] -%>"
                onclick="openAccordionItem(this.href, this); return false;"><%= number_with_precision(test_case[:covered_lines], :precision => 0) -%>
             </a>
index 6ddf7d2bda4f2974c67cb2d1633ddca261867d64..e202cdd20939b0ae0cac5d9b83925de0aba221a2 100644 (file)
@@ -5,27 +5,46 @@
   <br/>
   <div class="accordion-body">
     <% @test_case_by_test_plan.sort_by{|test_plan, test_cases| test_plan.component.longName}.each do |test_plan, test_cases| %>
-    <table class="data">
-      <thead>
-      <tr>
-        <th>
-        <% resource_key = test_plan.component.key %>
-        <a href="<%= ApplicationController.root_context -%>/resource/index/<%= resource_key -%>?display_title=true&tab=source"
-           onclick="openAccordionItem(this.href, this); return false;"><%= test_plan.component.longName %>
-        </a>
-        </th>
-      </tr>
-      </thead>
-      <tbody>
-      <% test_cases.sort_by{|test_case| test_case.name}.each do |test_case| %>
-      <tr class="<%= cycle("even", "odd") -%>">
-        <td>
-          <%= test_case.name -%>
-        </td>
-      </tr>
-      <% end %>
-      </tbody>
-    </table>
+      <% resource_key = test_plan.component.key %>
+      <table class="data">
+        <thead>
+        <tr>
+          <th colspan="3">
+            <a href="<%= ApplicationController.root_context -%>/resource/index/<%= resource_key -%>?display_title=true&tab=source"
+               onclick="openAccordionItem(this.href, this); return false;"><%= test_plan.component.longName %>
+            </a>
+          </th>
+        </tr>
+        </thead>
+        <tbody>
+        <% test_cases.sort_by{|test_case| test_case.name}.each do |test_case| %>
+        <tr class="<%= cycle("even", "odd") -%>">
+          <%
+             status = test_case.status
+             case status
+               when 'ok'
+                 icon_url = ApplicationController.root_context + "/images/levels/ok.png"
+               when 'failure'
+                 icon_url = ApplicationController.root_context + "/images/warning.png"
+               when 'error'
+                 icon_url = ApplicationController.root_context + "/images/levels/error.png"
+               when 'skipped'
+                 icon_url = ApplicationController.root_context + "/images/levels/none.png"
+               else
+                 icon_url = ApplicationController.root_context + "/images/levels/" + status + ".png"
+             end
+          %>
+          <td class="thin" nowrap>
+            <img src="<%= icon_url -%>"/>
+          </td>
+          <td class="thin right" nowrap><%= test_case.durationInMs -%> ms</td>
+          <td>
+            <%= test_case.name -%>
+          </td>
+        </tr>
+        <% end %>
+        </tbody>
+      </table>
       <br/>
     <% end %>
   </div>