Commit 34d1ea9e by Will Daly

Consolidated coverage report generation into one rake command.

Added diff coverage reports using diff-coverage tool.
parent 5eaa6aea
...@@ -197,9 +197,10 @@ To view test coverage: ...@@ -197,9 +197,10 @@ To view test coverage:
2. Generate reports: 2. Generate reports:
rake coverage:html rake coverage
3. HTML reports are located in the `reports` folder. 3. Reports are located in the `reports` folder. The command
generates HTML and XML (Cobertura format) reports.
## Testing using queue servers ## Testing using queue servers
......
...@@ -84,7 +84,8 @@ rake phantomjs_jasmine_cms || TESTS_FAILED=1 ...@@ -84,7 +84,8 @@ rake phantomjs_jasmine_cms || TESTS_FAILED=1
rake phantomjs_jasmine_common/lib/xmodule || TESTS_FAILED=1 rake phantomjs_jasmine_common/lib/xmodule || TESTS_FAILED=1
rake phantomjs_jasmine_common/static/coffee || TESTS_FAILED=1 rake phantomjs_jasmine_common/static/coffee || TESTS_FAILED=1
rake coverage:xml coverage:html # Generate coverage reports
rake coverage
[ $TESTS_FAILED == '0' ] [ $TESTS_FAILED == '0' ]
rake autodeploy_properties rake autodeploy_properties
......
...@@ -119,30 +119,17 @@ task :test do ...@@ -119,30 +119,17 @@ task :test do
end end
end end
namespace :coverage do desc "Build the html, xml, and diff coverage reports"
desc "Build the html coverage reports" task :coverage => :report_dirs do
task :html => :report_dirs do TEST_TASK_DIRS.each do |dir|
TEST_TASK_DIRS.each do |dir| report_dir = report_dir_path(dir)
report_dir = report_dir_path(dir)
if !File.file?("#{report_dir}/.coverage")
next
end
sh("coverage html --rcfile=#{dir}/.coveragerc") if !File.file?("#{report_dir}/.coverage")
next
end end
end
desc "Build the xml coverage reports" sh("coverage html --rcfile=#{dir}/.coveragerc")
task :xml => :report_dirs do sh("coverage xml -o #{report_dir}/coverage.xml --rcfile=#{dir}/.coveragerc")
TEST_TASK_DIRS.each do |dir| sh("diff-cover #{report_dir}/coverage.xml --html-report #{report_dir}/diff_cover.html --git-branch master...HEAD")
report_dir = report_dir_path(dir)
if !File.file?("#{report_dir}/.coverage")
next
end
# Why doesn't the rcfile control the xml output file properly??
sh("coverage xml -o #{report_dir}/coverage.xml --rcfile=#{dir}/.coveragerc")
end
end end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment