diff options
-rw-r--r-- | plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/web/tests_viewer.html.erb | 43 | ||||
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/views/test/_testable_working_view.erb | 17 | ||||
-rw-r--r-- | sonar-server/src/main/webapp/images/tests/FAILURE.png | bin | 0 -> 613 bytes | |||
-rw-r--r-- | sonar-server/src/main/webapp/images/tests/SKIPPED.png | bin | 0 -> 1297 bytes | |||
-rw-r--r-- | sonar-server/src/main/webapp/images/tests/error.png | bin | 0 -> 1297 bytes | |||
-rw-r--r-- | sonar-server/src/main/webapp/images/tests/ok.png | bin | 0 -> 1297 bytes | |||
-rw-r--r-- | sonar-server/src/main/webapp/javascripts/resource.js | 18 |
7 files changed, 25 insertions, 53 deletions
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/web/tests_viewer.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/web/tests_viewer.html.erb index 1daa013ee80..426aa7d701e 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/web/tests_viewer.html.erb +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/web/tests_viewer.html.erb @@ -39,7 +39,7 @@ blocks.elements.each("tests-details/testcase") do |block| test_case = {} test_case[:name] = block.attributes['name'] - test_case[:status] = block.attributes['status'] + test_case[:status] = block.attributes['status'].upcase test_case[:time] = block.attributes['time'] error = block.elements['error'] @@ -56,15 +56,15 @@ if test_plan test_plan.testCases().each do |test| test_case = {} - test_case[:name] = test.name() - test_case[:status] = test.status().to_s - test_case[:time] = test.durationInMs() - has_covered_lines = test.doesCover() - test_case[:covered_lines] = test.countCoveredLines() if has_covered_lines + test_case[:name] = test.name + test_case[:status] = test.status.name + test_case[:time] = test.durationInMs + has_covered_lines = test.doesCover + test_case[:covered_lines] = test.countCoveredLines if has_covered_lines if test.status().to_s != 'ok' test_case[:message] = '' - test_case[:message] = test.message() if test.message() - test_case[:stack_trace] = html_escape(test.stackTrace()) + test_case[:message] = test.message if test.message + test_case[:stack_trace] = html_escape(test.stackTrace) end test_cases << test_case end @@ -90,23 +90,8 @@ test_cases.each_with_index do |test_case, index| %> <tr class="<%= cycle("even", "odd") -%> testdata_<%= index -%>" display="table-row"> - <% - 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 class="test_status_<%= index -%>_<%= status -%>" src="<%= icon_url -%>"/> + <img class="test_status_<%= index -%>_<%= test_case[:status] -%>" src="<%= ApplicationController.root_context + "/images/tests/" + test_case[:status] + ".png" -%>"/> </td> <td class="test_time_<%= index -%> thin right" nowrap><%= test_case[:time] -%> ms</td> <% if has_covered_lines %> @@ -119,17 +104,17 @@ <td> <span class="test_name_<%= index -%>"> <% name = test_case[:name] %> - <% if test_case[:message] %> - <a class="test_expandLink_<%= index -%>" href="#" onclick="expandTests(<%= index -%>);"><%= name -%></a> - <a class="test_collapseLink_<%= index -%>" class="collapse" href="#" onclick="collapseTests(<%= index -%>);" style="display: none;"><%= name -%></a> + <% if !test_case[:message].blank? || !test_case[:stack_trace].blank? %> + <a class="test_expandLink_<%= index -%>" href="#" onclick="expandTests(<%= index -%>, this);"><%= name -%></a> + <a class="test_collapseLink_<%= index -%>" class="collapse" href="#" onclick="collapseTests(<%= index -%>, this);" style="display: none;"><%= name -%></a> <% else %> <%= name -%> <% end %> </span> - <% if test_case[:message] %> + <% if !test_case[:message].blank? || !test_case[:stack_trace].blank? %> <div class="test_message_<%= index -%>" class="message" style="display:none; margin-top:5px;"> - <% message = test_case[:message] %> + <% message = test_case[:message] %> <% if !message.nil? %> <span><%= h message -%></span> <% end %> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/test/_testable_working_view.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/test/_testable_working_view.erb index e202cdd2093..7254910a470 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/test/_testable_working_view.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/test/_testable_working_view.erb @@ -19,23 +19,8 @@ <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 -%>"/> + <img src="<%= ApplicationController.root_context + "/images/tests/" + test_case.status.name + ".png" -%>"/> </td> <td class="thin right" nowrap><%= test_case.durationInMs -%> ms</td> <td> diff --git a/sonar-server/src/main/webapp/images/tests/FAILURE.png b/sonar-server/src/main/webapp/images/tests/FAILURE.png Binary files differnew file mode 100644 index 00000000000..f00e4264181 --- /dev/null +++ b/sonar-server/src/main/webapp/images/tests/FAILURE.png diff --git a/sonar-server/src/main/webapp/images/tests/SKIPPED.png b/sonar-server/src/main/webapp/images/tests/SKIPPED.png Binary files differnew file mode 100644 index 00000000000..6e871b22585 --- /dev/null +++ b/sonar-server/src/main/webapp/images/tests/SKIPPED.png diff --git a/sonar-server/src/main/webapp/images/tests/error.png b/sonar-server/src/main/webapp/images/tests/error.png Binary files differnew file mode 100644 index 00000000000..0da4d846a66 --- /dev/null +++ b/sonar-server/src/main/webapp/images/tests/error.png diff --git a/sonar-server/src/main/webapp/images/tests/ok.png b/sonar-server/src/main/webapp/images/tests/ok.png Binary files differnew file mode 100644 index 00000000000..fb454cefd5c --- /dev/null +++ b/sonar-server/src/main/webapp/images/tests/ok.png diff --git a/sonar-server/src/main/webapp/javascripts/resource.js b/sonar-server/src/main/webapp/javascripts/resource.js index 1972e35db58..5f5347d2d4a 100644 --- a/sonar-server/src/main/webapp/javascripts/resource.js +++ b/sonar-server/src/main/webapp/javascripts/resource.js @@ -186,14 +186,16 @@ function hVF(elt, line) { /* Functions used in tests viewer */ -function expandTests(index){ - $j(".tests_viewer #test_collapseLink_"+ index).show(); - $j(".tests_viewer #test_expandLink_"+ index).hide(); - $j(".tests_viewer #test_message_"+ index).show(); +function expandTests(index, elt){ + var parent = $j(elt).closest('.test_name_'+index); + parent.find(".test_expandLink_"+ index).hide(); + parent.find(".test_collapseLink_"+ index).show(); + parent.next(".tests_viewer .test_message_"+ index).show(); } -function collapseTests(index){ - $j(".tests_viewer #test_collapseLink_"+ index).hide(); - $j(".tests_viewer #test_expandLink_"+ index).show(); - $j(".tests_viewer #test_message_"+ index).hide(); +function collapseTests(index, elt){ + var parent = $j(elt).closest('.test_name_'+index); + parent.find(".test_collapseLink_"+ index).hide(); + parent.find(".test_expandLink_"+ index).show(); + parent.next(".tests_viewer .test_message_"+ index).hide(); }
\ No newline at end of file |