Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
ee011597
Commit
ee011597
authored
Jun 05, 2013
by
Will Daly
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #68 from edx/will/diff-cover-integration
Will/diff cover integration
parents
5d3f6dc4
e1d3fb73
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
29 deletions
+45
-29
doc/testing.md
+3
-2
jenkins/test.sh
+2
-1
rakefiles/tests.rake
+39
-26
requirements/edx/github.txt
+1
-0
No files found.
doc/testing.md
View file @
ee011597
...
...
@@ -202,9 +202,10 @@ To view test coverage:
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
...
...
jenkins/test.sh
View file @
ee011597
...
...
@@ -84,7 +84,8 @@ rake phantomjs_jasmine_cms || TESTS_FAILED=1
rake phantomjs_jasmine_common/lib/xmodule
||
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'
]
rake autodeploy_properties
...
...
rakefiles/tests.rake
View file @
ee011597
...
...
@@ -45,6 +45,12 @@ end
directory
REPORT_DIR
task
:clean_test_files
do
# Delete all files in the reports directory, while preserving
# the directory structure.
sh
(
"find
#{
REPORT_DIR
}
-type f -print0 | xargs --no-run-if-empty -0 rm"
)
# Reset the test fixtures
sh
(
"git clean -fqdx test_root"
)
end
...
...
@@ -81,12 +87,11 @@ TEST_TASK_DIRS = []
end
Dir
[
"common/lib/*"
].
select
{
|
lib
|
File
.
directory?
(
lib
)}.
each
do
|
lib
|
task_name
=
"test_
#{
lib
}
"
report_dir
=
report_dir_path
(
lib
)
desc
"Run tests for common lib
#{
lib
}
"
task
task_name
=>
report_dir
do
task
"test_
#{
lib
}
"
=>
[
"clean_test_files"
,
report_dir
]
do
ENV
[
'NOSE_XUNIT_FILE'
]
=
File
.
join
(
report_dir
,
"nosetests.xml"
)
cmd
=
"nosetests
#{
lib
}
"
sh
(
run_under_coverage
(
cmd
,
lib
))
do
|
ok
,
res
|
...
...
@@ -95,10 +100,13 @@ Dir["common/lib/*"].select{|lib| File.directory?(lib)}.each do |lib|
end
TEST_TASK_DIRS
<<
lib
desc
"Run tests for common lib
#{
lib
}
(without coverage)"
task
"fasttest_
#{
lib
}
"
do
sh
(
"nosetests
#{
lib
}
"
)
end
# There used to be a fasttest_#{lib} command that ran without coverage.
# However, this is an inconsistent usage of "fast":
# When running tests for lms and cms, "fast" means skipping
# staticfiles collection, but still running under coverage.
# We keep the fasttest_#{lib} command for backwards compatibility,
# but make it an alias to the normal test command.
task
"fasttest_
#{
lib
}
"
=>
"test_
#{
lib
}
"
end
task
:report_dirs
...
...
@@ -119,30 +127,35 @@ task :test do
end
end
namespace
:coverage
do
desc
"Build the html coverage reports"
task
:html
=>
:report_dirs
do
TEST_TASK_DIRS
.
each
do
|
dir
|
report_dir
=
report_dir_path
(
dir
)
desc
"Build the html, xml, and diff coverage reports"
task
:coverage
=>
:report_dirs
do
if
!
File
.
file?
(
"
#{
report_dir
}
/.coverage"
)
next
end
found_coverage_info
=
false
sh
(
"coverage html --rcfile=
#{
dir
}
/.coveragerc"
)
TEST_TASK_DIRS
.
each
do
|
dir
|
report_dir
=
report_dir_path
(
dir
)
if
!
File
.
file?
(
"
#{
report_dir
}
/.coverage"
)
next
else
found_coverage_info
=
true
end
end
desc
"Build the xml coverage reports"
task
:xml
=>
:report_dirs
do
TEST_TASK_DIRS
.
each
do
|
dir
|
report_dir
=
report_dir_path
(
dir
)
# Generate the coverage.py HTML report
sh
(
"coverage html --rcfile=
#{
dir
}
/.coveragerc"
)
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
# Generate the coverage.py XML report
sh
(
"coverage xml -o
#{
report_dir
}
/coverage.xml --rcfile=
#{
dir
}
/.coveragerc"
)
# Generate the diff coverage HTML report, based on the XML report
sh
(
"diff-cover
#{
report_dir
}
/coverage.xml --html-report
#{
report_dir
}
/diff_cover.html"
)
# Print the diff coverage report to the console
sh
(
"diff-cover
#{
report_dir
}
/coverage.xml"
)
puts
"
\n
"
end
if
not
found_coverage_info
puts
"No coverage info found. Run `rake test` before running `rake coverage`."
end
end
requirements/edx/github.txt
View file @
ee011597
...
...
@@ -10,3 +10,4 @@
# Our libraries:
-e git+https://github.com/edx/XBlock.git@2144a25d#egg=XBlock
-e git+https://github.com/edx/codejail.git@5fb5fa0#egg=codejail
-e git+https://github.com/edx/diff-cover.git@v0.1.0#egg=diff_cover
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment