@@ -1,46 +1,16 | |||||
1 | Creating test repositories |
|
|||
2 | =================== |
|
|||
3 |
|
||||
4 | mkdir tmp/test |
|
|||
5 |
|
||||
6 | Subversion |
|
|||
7 | ---------- |
|
|||
8 | svnadmin create tmp/test/subversion_repository |
|
|||
9 | gunzip < test/fixtures/repositories/subversion_repository.dump.gz | svnadmin load tmp/test/subversion_repository |
|
|||
10 |
|
||||
11 | CVS |
|
|||
12 | --- |
|
|||
13 | gunzip < test/fixtures/repositories/cvs_repository.tar.gz | tar -xv -C tmp/test |
|
|||
14 |
|
||||
15 | Bazaar |
|
|||
16 | ------ |
|
|||
17 | gunzip < test/fixtures/repositories/bazaar_repository.tar.gz | tar -xv -C tmp/test |
|
|||
18 |
|
||||
19 | Mercurial |
|
|||
20 | --------- |
|
|||
21 | gunzip < test/fixtures/repositories/mercurial_repository.tar.gz | tar -xv -C tmp/test |
|
|||
22 |
|
||||
23 | Git |
|
|||
24 | --- |
|
|||
25 | gunzip < test/fixtures/repositories/git_repository.tar.gz | tar -xv -C tmp/test |
|
|||
26 |
|
||||
27 | Darcs (2.0+ required) |
|
|||
28 | --------------------- |
|
|||
29 | gunzip < test/fixtures/repositories/darcs_repository.tar.gz | tar -xv -C tmp/test |
|
|||
30 |
|
||||
31 | FileSystem |
|
|||
32 | ---------- |
|
|||
33 | gunzip < test/fixtures/repositories/filesystem_repository.tar.gz | tar -xv -C tmp/test |
|
|||
34 |
|
||||
35 |
|
||||
36 | Running Tests |
|
1 | Running Tests | |
37 | ============= |
|
2 | ============= | |
38 |
|
3 | |||
39 | Run |
|
4 | Run `rake --tasks test` to see available tests. | |
|
5 | `rake test` will run the entire testsuite. | |||
40 |
|
6 | |||
41 | rake --tasks | grep test |
|
|||
42 |
|
7 | |||
43 | to see available tests. |
|
8 | Creating test repositories | |
|
9 | =================== | |||
|
10 | ||||
|
11 | Redmine supports a wide array of different version control systems. | |||
|
12 | To test the support, a test repository needs to be created for each of those. | |||
44 |
|
13 | |||
45 | RAILS_ENV=test rake test will run tests. |
|
14 | Run `rake --tasks test:scm:setup` for a list of available test-repositories or | |
|
15 | run `rake test:scm:setup:all` to set up all of them | |||
46 |
|
16 |
@@ -1,46 +1,76 | |||||
1 | ### From http://svn.geekdaily.org/public/rails/plugins/generally_useful/tasks/coverage_via_rcov.rake |
|
1 | ### From http://svn.geekdaily.org/public/rails/plugins/generally_useful/tasks/coverage_via_rcov.rake | |
2 |
|
2 | |||
|
3 | namespace :test do | |||
|
4 | namespace :scm do | |||
|
5 | namespace :setup do | |||
|
6 | desc "Creates directory for test repositories" | |||
|
7 | task :create_dir do | |||
|
8 | FileUtils.mkdir_p Rails.root + '/tmp/test' | |||
|
9 | end | |||
|
10 | ||||
|
11 | supported_scms = [:subversion, :cvs, :bazaar, :mercurial, :git, :darcs, :filesystem] | |||
|
12 | ||||
|
13 | desc "Creates a test subversion repository" | |||
|
14 | task :subversion => :create_dir do | |||
|
15 | repo_path = "tmp/test/subversion_repository" | |||
|
16 | system "svnadmin create #{repo_path}" | |||
|
17 | system "gunzip < test/fixtures/repositories/subversion_repository.dump.gz | svnadmin load #{repo_path}" | |||
|
18 | end | |||
|
19 | ||||
|
20 | (supported_scms - [:subversion]).each do |scm| | |||
|
21 | desc "Creates a test #{scm} repository" | |||
|
22 | task scm => :create_dir do | |||
|
23 | system "gunzip < test/fixtures/repositories/#{scm}_repository.tar.gz | tar -xv -C tmp/test" | |||
|
24 | end | |||
|
25 | end | |||
|
26 | ||||
|
27 | desc "Creates all test repositories" | |||
|
28 | task :all => supported_scms | |||
|
29 | end | |||
|
30 | end | |||
|
31 | end | |||
|
32 | ||||
3 | ### Inspired by http://blog.labratz.net/articles/2006/12/2/a-rake-task-for-rcov |
|
33 | ### Inspired by http://blog.labratz.net/articles/2006/12/2/a-rake-task-for-rcov | |
4 | begin |
|
34 | begin | |
5 | require 'rcov/rcovtask' |
|
35 | require 'rcov/rcovtask' | |
6 |
|
36 | |||
7 | rcov_options = "--rails --aggregate test/coverage.data --exclude '/gems/'" |
|
37 | rcov_options = "--rails --aggregate test/coverage.data --exclude '/gems/'" | |
8 |
|
38 | |||
9 | namespace :test do |
|
39 | namespace :test do | |
10 | desc "Aggregate code coverage for all tests" |
|
40 | desc "Aggregate code coverage for all tests" | |
11 | Rcov::RcovTask.new('coverage') do |t| |
|
41 | Rcov::RcovTask.new('coverage') do |t| | |
12 | t.libs << 'test' |
|
42 | t.libs << 'test' | |
13 | t.test_files = FileList['test/{unit,integration,functional}/*_test.rb'] |
|
43 | t.test_files = FileList['test/{unit,integration,functional}/*_test.rb'] | |
14 | t.verbose = true |
|
44 | t.verbose = true | |
15 | t.rcov_opts << rcov_options |
|
45 | t.rcov_opts << rcov_options | |
16 | end |
|
46 | end | |
17 |
|
47 | |||
18 | namespace :coverage do |
|
48 | namespace :coverage do | |
19 | desc "Delete coverage test data" |
|
49 | desc "Delete coverage test data" | |
20 | task :clean do |
|
50 | task :clean do | |
21 | rm_f "test/coverage.data" |
|
51 | rm_f "test/coverage.data" | |
22 | rm_rf "test/coverage" |
|
52 | rm_rf "test/coverage" | |
23 | end |
|
53 | end | |
24 |
|
54 | |||
25 | desc "Aggregate code coverage for all tests with HTML output" |
|
55 | desc "Aggregate code coverage for all tests with HTML output" | |
26 | Rcov::RcovTask.new('html') do |t| |
|
56 | Rcov::RcovTask.new('html') do |t| | |
27 | t.libs << 'test' |
|
57 | t.libs << 'test' | |
28 | t.test_files = FileList['test/{unit,integration,functional}/*_test.rb'] |
|
58 | t.test_files = FileList['test/{unit,integration,functional}/*_test.rb'] | |
29 | t.output_dir = "test/coverage" |
|
59 | t.output_dir = "test/coverage" | |
30 | t.verbose = true |
|
60 | t.verbose = true | |
31 | t.rcov_opts << rcov_options |
|
61 | t.rcov_opts << rcov_options | |
32 | end |
|
62 | end | |
33 |
|
63 | |||
34 | desc "Open the HTML coverage report" |
|
64 | desc "Open the HTML coverage report" | |
35 | task :show_results do |
|
65 | task :show_results do | |
36 | system "open test/coverage/index.html" |
|
66 | system "open test/coverage/index.html" | |
37 | end |
|
67 | end | |
38 |
|
68 | |||
39 | task :full => "test:coverage:clean" |
|
69 | task :full => "test:coverage:clean" | |
40 | task :full => "test:coverage:html" |
|
70 | task :full => "test:coverage:html" | |
41 | task :full => "test:coverage:show_results" |
|
71 | task :full => "test:coverage:show_results" | |
42 | end |
|
72 | end | |
43 | end |
|
73 | end | |
44 | rescue LoadError |
|
74 | rescue LoadError | |
45 | # rcov not available |
|
75 | # rcov not available | |
46 | end |
|
76 | end |
General Comments 0
You need to be logged in to leave comments.
Login now