diff options
author | Julien Lancelot <julien.lancelot@gmail.com> | 2013-02-01 14:36:49 +0100 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@gmail.com> | 2013-02-01 14:37:03 +0100 |
commit | 778c23f48631479a95477cbd3cbba8f7daedc1ce (patch) | |
tree | ee5e9374952f5fb7d884f1658fa2b7893106bc0e /sonar-server | |
parent | a9203f4791002a127872f6e09a4f20de44502aa8 (diff) | |
download | sonarqube-778c23f48631479a95477cbd3cbba8f7daedc1ce.tar.gz sonarqube-778c23f48631479a95477cbd3cbba8f7daedc1ce.zip |
SONAR-4093 Display test by test plan
Diffstat (limited to 'sonar-server')
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb | 9 | ||||
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options.html.erb | 8 |
2 files changed, 15 insertions, 2 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb index 651b2f1b588..cd0fed3d6b7 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/resource_controller.rb @@ -250,6 +250,15 @@ class ResourceController < ApplicationController filter_lines { |line| line.conditions && line.covered_conditions && line.covered_conditions<line.conditions && line.after(to) } elsif @coverage_filter == 'lines_covered_per_test' + @test_case_by_test_plan = {} + @testable.testCases.each do |test_case| + test_plan = test_case.testPlan + test_cases = @test_case_by_test_plan[test_plan] + test_cases = [] unless test_cases + test_cases << test_case + @test_case_by_test_plan[test_plan] = test_cases + end + if @test_case_filter test_case = @testable.testCaseByKey(@test_case_filter) lines = @testable.coverOfTestCase(test_case).lines diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options.html.erb index f96ca310f91..db6bc1934c8 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_options.html.erb @@ -101,8 +101,12 @@ <td class="<%= 'first' if first -%>"> <select id="test_case_filter" name="test_case_filter" onchange="applyOptions()"> <option value=""><%= message('coverage_viewer.select_test') -%></option> - <% @testable.testCases.each do |test_case| %> - <option value="<%= test_case.key -%>" <%= 'selected' if @test_case_filter==test_case.key -%>><%= test_case.name -%></option> + <% @test_case_by_test_plan.sort_by{|test_plan, test_cases| test_plan.component.longName}.each do |test_plan, test_cases| %> + <optgroup label="<%= test_plan.component.longName %>"> + <% test_cases.sort_by{|test_case| test_case.name}.each do |test_case| %> + <option value="<%= test_case.key -%>" <%= 'selected' if @test_case_filter==test_case.key -%>><%= test_case.name -%></option> + <% end %> + </optgroup> <% end %> </select> </td> |