Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
ee011597
Commit
ee011597
authored
11 years ago
by
Will Daly
Browse files
Options
Downloads
Plain Diff
Merge pull request #68 from edx/will/diff-cover-integration
Will/diff cover integration
parents
5d3f6dc4
e1d3fb73
Loading
Loading
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
doc/testing.md
+3
-2
3 additions, 2 deletions
doc/testing.md
jenkins/test.sh
+2
-1
2 additions, 1 deletion
jenkins/test.sh
rakefiles/tests.rake
+39
-26
39 additions, 26 deletions
rakefiles/tests.rake
requirements/edx/github.txt
+1
-0
1 addition, 0 deletions
requirements/edx/github.txt
with
45 additions
and
29 deletions
doc/testing.md
+
3
−
2
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
...
...
This diff is collapsed.
Click to expand it.
jenkins/test.sh
+
2
−
1
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
...
...
This diff is collapsed.
Click to expand it.
rakefiles/tests.rake
+
39
−
26
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
This diff is collapsed.
Click to expand it.
requirements/edx/github.txt
+
1
−
0
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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment