albacore 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. data/README.markdown +84 -81
  2. data/VERSION +1 -1
  3. data/install_dependencies.rb +10 -10
  4. data/lib/albacore.rb +10 -2
  5. data/lib/albacore/assemblyinfo.rb +100 -100
  6. data/lib/albacore/assemblyinfolanguages/csharpengine.rb +14 -0
  7. data/lib/albacore/assemblyinfolanguages/vbnetengine.rb +14 -0
  8. data/lib/albacore/docu.rb +39 -0
  9. data/lib/albacore/exec.rb +23 -0
  10. data/lib/albacore/expandtemplates.rb +73 -71
  11. data/lib/albacore/msbuild.rb +56 -61
  12. data/lib/albacore/mspectestrunner.rb +44 -42
  13. data/lib/albacore/nant.rb +39 -0
  14. data/lib/albacore/ncoverconsole.rb +68 -61
  15. data/lib/albacore/ncoverreport.rb +56 -55
  16. data/lib/albacore/ncoverreports/assemblyfilter.rb +7 -7
  17. data/lib/albacore/ncoverreports/branchcoverage.rb +7 -7
  18. data/lib/albacore/ncoverreports/classfilter.rb +5 -5
  19. data/lib/albacore/ncoverreports/codecoveragebase.rb +22 -22
  20. data/lib/albacore/ncoverreports/cyclomaticcomplexity.rb +19 -19
  21. data/lib/albacore/ncoverreports/documentfilter.rb +5 -5
  22. data/lib/albacore/ncoverreports/fullcoveragereport.rb +17 -17
  23. data/lib/albacore/ncoverreports/methodcoverage.rb +7 -7
  24. data/lib/albacore/ncoverreports/methodfilter.rb +5 -5
  25. data/lib/albacore/ncoverreports/namespacefilter.rb +5 -5
  26. data/lib/albacore/ncoverreports/reportfilterbase.rb +23 -23
  27. data/lib/albacore/ncoverreports/summaryreport.rb +18 -18
  28. data/lib/albacore/ncoverreports/symbolcoverage.rb +6 -7
  29. data/lib/albacore/ndepend.rb +35 -0
  30. data/lib/albacore/nunittestrunner.rb +36 -35
  31. data/lib/albacore/plink.rb +48 -0
  32. data/lib/albacore/sftp.rb +33 -31
  33. data/lib/albacore/sqlcmd.rb +54 -51
  34. data/lib/albacore/ssh.rb +35 -33
  35. data/lib/albacore/support/albacore_helper.rb +1 -4
  36. data/lib/albacore/support/attrmethods.rb +25 -0
  37. data/lib/albacore/support/failure.rb +17 -17
  38. data/lib/albacore/support/globalconfig.rb +6 -0
  39. data/lib/albacore/support/logging.rb +30 -28
  40. data/lib/albacore/support/runcommand.rb +41 -41
  41. data/lib/albacore/support/yamlconfig.rb +23 -27
  42. data/lib/albacore/unzip.rb +28 -0
  43. data/lib/albacore/xbuild.rb +54 -0
  44. data/lib/albacore/xunittestrunner.rb +40 -43
  45. data/lib/albacore/zipdirectory.rb +72 -63
  46. data/lib/rake/assemblyinfotask.rb +12 -11
  47. data/lib/rake/docutask.rb +17 -0
  48. data/lib/rake/exectask.rb +18 -0
  49. data/lib/rake/expandtemplatestask.rb +12 -11
  50. data/lib/rake/msbuildtask.rb +13 -12
  51. data/lib/rake/mspectask.rb +12 -11
  52. data/lib/rake/nanttask.rb +17 -0
  53. data/lib/rake/ncoverconsoletask.rb +12 -11
  54. data/lib/rake/ncoverreporttask.rb +12 -11
  55. data/lib/rake/ndependtask.rb +23 -0
  56. data/lib/rake/nunittask.rb +12 -11
  57. data/lib/rake/plinktask.rb +23 -0
  58. data/lib/rake/renametask.rb +15 -15
  59. data/lib/rake/sftptask.rb +11 -10
  60. data/lib/rake/sqlcmdtask.rb +13 -12
  61. data/lib/rake/sshtask.rb +11 -10
  62. data/lib/rake/support/albacoretask.rb +16 -15
  63. data/lib/rake/unziptask.rb +17 -0
  64. data/lib/rake/xbuildtask.rb +22 -0
  65. data/lib/rake/xunittask.rb +12 -11
  66. data/lib/rake/ziptask.rb +12 -11
  67. data/rakefile.rb +255 -204
  68. data/spec/assemblyinfo_spec.rb +426 -221
  69. data/spec/assemblyinfotask_spec.rb +21 -21
  70. data/spec/docu_spec.rb +70 -0
  71. data/spec/docutask_spec.rb +39 -0
  72. data/spec/exec_spec.rb +23 -0
  73. data/spec/exectask_spec.rb +31 -0
  74. data/spec/expandtemplates_spec.rb +149 -148
  75. data/spec/expandtemplatestask_spec.rb +21 -21
  76. data/spec/msbuild_spec.rb +150 -139
  77. data/spec/msbuildtask_spec.rb +21 -21
  78. data/spec/mspectask_spec.rb +21 -21
  79. data/spec/nant_spec.rb +101 -0
  80. data/spec/nanttask_spec.rb +31 -0
  81. data/spec/ncoverconsole_spec.rb +253 -221
  82. data/spec/ncoverconsoletask_spec.rb +21 -21
  83. data/spec/ncoverreport_spec.rb +538 -523
  84. data/spec/ncoverreporttask_spec.rb +21 -21
  85. data/spec/ndepend_spec.rb +49 -0
  86. data/spec/{commandtask_spec.rb → ndependtask_spec.rb} +10 -10
  87. data/spec/nunittask_spec.rb +21 -21
  88. data/spec/nunittestrunner_spec.rb +6 -6
  89. data/spec/patches/docu_patch.rb +13 -0
  90. data/spec/patches/system_patch.rb +18 -18
  91. data/spec/patches/tasklib_patch.rb +10 -10
  92. data/spec/plink_spec.rb +61 -0
  93. data/spec/plinktask_spec.rb +31 -0
  94. data/spec/renametask_spec.rb +21 -21
  95. data/spec/sftp_spec.rb +24 -24
  96. data/spec/sftptask_spec.rb +31 -31
  97. data/spec/sqlcmd_spec.rb +118 -120
  98. data/spec/sqlcmdtask_spec.rb +21 -21
  99. data/spec/ssh_spec.rb +36 -37
  100. data/spec/sshtask_spec.rb +29 -29
  101. data/spec/support/TestSolution/NDependProject.xml +315 -0
  102. data/spec/support/TestSolution/TestSolution.XUnitTests/Class1.cs +12 -12
  103. data/spec/support/TestSolution/TestSolution.XUnitTests/FailingTestFixture.cs +14 -0
  104. data/spec/support/TestSolution/TestSolution.XUnitTests/TestSolution.XUnitTests.csproj +1 -0
  105. data/spec/support/TestSolution/TestSolution.build +25 -0
  106. data/spec/support/assemblyinfotester.rb +40 -38
  107. data/spec/support/expandtemplatestestdata.rb +73 -73
  108. data/spec/support/msbuildtestdata.rb +28 -28
  109. data/spec/support/nanttestdata.rb +33 -0
  110. data/spec/support/ncoverconsoletestdata.rb +18 -0
  111. data/spec/support/ncoverreporttestdata.rb +24 -24
  112. data/spec/support/spec_helper.rb +2 -1
  113. data/spec/support/yamlconfig/msbuild.yml +3 -0
  114. data/spec/support/yamlconfig/yaml_autoconfig_test.yml +1 -0
  115. data/spec/support/ziptestdata.rb +11 -6
  116. data/spec/xunit_spec.rb +63 -0
  117. data/spec/xunittask_spec.rb +19 -19
  118. data/spec/yamlconfig_spec.rb +38 -52
  119. data/spec/zip_spec.rb +56 -11
  120. data/spec/ziptask_spec.rb +22 -22
  121. metadata +53 -8
  122. data/lib/albacore/command.rb +0 -23
  123. data/lib/rake/commandtask.rb +0 -16
  124. data/spec/command_spec.rb +0 -23
@@ -0,0 +1,101 @@
1
+ require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
2
+ require 'albacore/nant'
3
+ require 'nanttestdata'
4
+
5
+ shared_examples_for "prepping nant" do
6
+ before :all do
7
+ @testdata = NAntTestData.new
8
+ @nant = @testdata.nant
9
+ @strio = StringIO.new
10
+ @nant.log_device = @strio
11
+ end
12
+
13
+ after :all do
14
+ @testdata.clean_output
15
+ end
16
+ end
17
+
18
+ describe NAnt, "when a nant path is not specified" do
19
+ it_should_behave_like "prepping nant"
20
+
21
+ before :all do
22
+ @log_data = @strio.string
23
+ @nant.run
24
+ end
25
+
26
+ it "should fail" do
27
+ @nant.failed.should == true
28
+ end
29
+
30
+ it "should log the missing command path" do
31
+ @log_data.should include("Command not found: ")
32
+ end
33
+ end
34
+
35
+ describe NAnt, "when running a nant build file" do
36
+ it_should_behave_like "prepping nant"
37
+
38
+ before :all do
39
+ @nant.path_to_command = @testdata.nant_path
40
+ @nant.build_file = @testdata.build_file_path
41
+ @nant.run
42
+ end
43
+
44
+ it "should execute the default task" do
45
+ File.exists?("#{@testdata.output_path}/buildfile.txt").should be true
46
+ end
47
+ end
48
+
49
+ describe NAnt, "when running specific targets" do
50
+ it_should_behave_like "prepping nant"
51
+
52
+ before :all do
53
+ @nant.path_to_command = @testdata.nant_path
54
+ @nant.build_file = @testdata.build_file_path
55
+ @nant.targets :build, :other
56
+ @nant.run
57
+ end
58
+
59
+ it "should execute the first task" do
60
+ File.exists?("#{@testdata.output_path}/buildfile.txt").should be true
61
+ end
62
+
63
+ it "should execute the second task" do
64
+ File.exists?("#{@testdata.output_path}/otherfile.txt").should be true
65
+ end
66
+ end
67
+
68
+ describe NAnt, "when specifying multiple configuration properties" do
69
+
70
+ before :all do
71
+ @testdata = NAntTestData.new(:fast,"1.2.3")
72
+ @nant = @testdata.nant
73
+ @strio = StringIO.new
74
+ @nant.log_device = @strio
75
+ @nant.path_to_command = @testdata.nant_path
76
+ @nant.build_file = @testdata.build_file_path
77
+
78
+ @nant.properties :version => "1.2.3", "build.mode" => :fast, :debug => false
79
+ @nant.run
80
+ end
81
+
82
+ it "should spedify the first property" do
83
+ @nant.system_command.should include("-D:version=1.2.3")
84
+ end
85
+
86
+ it "should spedify the second property" do
87
+ @nant.system_command.should include("-D:build.mode=fast")
88
+ end
89
+
90
+ it "should spedify the last property" do
91
+ @nant.system_command.should include("-D:debug=false")
92
+ end
93
+
94
+ it "should create the output file" do
95
+ File.exists?("#{@testdata.output_path}/buildfile.txt").should be true
96
+ end
97
+
98
+ after :all do
99
+ @testdata.clean_output
100
+ end
101
+ end
@@ -0,0 +1,31 @@
1
+ require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
2
+ require 'albacore/nant'
3
+ require 'rake/nanttask'
4
+ require 'tasklib_patch'
5
+
6
+ describe Albacore::NAntTask, "when running" do
7
+ before :all do
8
+ task = Albacore::NAntTask.new(:nant) do |t|
9
+ @yielded_object = t
10
+ end
11
+ task.extend(TasklibPatch)
12
+ Rake::Task[:nant].invoke
13
+ end
14
+
15
+ it "should yield the nant api" do
16
+ @yielded_object.kind_of?(NAnt).should == true
17
+ end
18
+ end
19
+
20
+ describe Albacore::NAntTask, "when execution fails" do
21
+ before :all do
22
+ @task = Albacore::NAntTask.new(:nant_failingtask)
23
+ @task.extend(TasklibPatch)
24
+ @task.fail
25
+ Rake::Task[:nant_failingtask].invoke
26
+ end
27
+
28
+ it "should fail the rake task" do
29
+ @task.task_failed.should == true
30
+ end
31
+ end
@@ -2,246 +2,278 @@ require File.join(File.dirname(__FILE__), 'support', 'spec_helper')
2
2
  require 'albacore/ncoverconsole'
3
3
  require 'albacore/nunittestrunner'
4
4
  require 'albacore/mspectestrunner'
5
+ require 'ncoverconsoletestdata'
5
6
 
6
- @@ncoverpath = File.join(File.dirname(__FILE__), 'support', 'Tools', 'NCover-v3.3', 'NCover.Console.exe')
7
- @@nunitpath = File.join(File.dirname(__FILE__), 'support', 'Tools', 'NUnit-v2.5', 'nunit-console-x86.exe')
8
- @@xml_coverage_output = File.join(File.expand_path(File.dirname(__FILE__)), 'support', 'CodeCoverage', 'nunit', 'test-coverage.xml')
9
- @@html_coverage_output = File.join(File.expand_path(File.dirname(__FILE__)), 'support', 'CodeCoverage', 'nunit', 'html', 'test-coverage.html')
10
- @@working_directory = File.join(File.expand_path(File.dirname(__FILE__)), 'support', 'CodeCoverage', 'nunit')
11
- @@test_assembly = File.join(File.expand_path(File.dirname(__FILE__)), 'support', 'CodeCoverage', 'nunit', 'assemblies', 'TestSolution.Tests.dll')
12
- @@failing_test_assembly = File.join(File.expand_path(File.dirname(__FILE__)), 'support', 'CodeCoverage', 'nunit', 'failing_assemblies', 'TestSolution.FailingTests.dll')
13
-
14
- @@mspecpath = File.join(File.dirname(__FILE__), 'support', 'Tools', 'Machine.Specification-v0.2', 'Machine.Specifications.ConsoleRunner.exe')
15
- @@mspec_html_output = File.join(File.expand_path(File.dirname(__FILE__)), 'support', 'CodeCoverage', 'mspec', 'html')
16
- @@mspec_test_assembly = File.join(File.expand_path(File.dirname(__FILE__)), 'support', 'CodeCoverage', 'mspec', 'assemblies', 'TestSolution.MSpecTests.dll')
17
-
18
- describe NCoverConsole, "when specifying aseemblies to cover" do
19
- before :all do
20
- File.delete(@@xml_coverage_output) if File.exist?(@@xml_coverage_output)
21
-
22
- @ncc = NCoverConsole.new()
23
-
24
- @ncc.extend(SystemPatch)
25
- @ncc.log_level = :verbose
26
- @ncc.path_to_command = @@ncoverpath
27
- @ncc.output = {:xml => @@xml_coverage_output}
28
- @ncc.working_directory = @@working_directory
29
- @ncc.cover_assemblies << "TestSolution"
30
-
31
- nunit = NUnitTestRunner.new(@@nunitpath)
32
- nunit.assemblies << @@test_assembly
33
- nunit.options << '/noshadow'
34
-
35
- @ncc.testrunner = nunit
36
- @ncc.run
37
- end
38
-
39
- it "should provide coverage for the specified assemblies" do
40
- @ncc.system_command.should include("//assemblies \"TestSolution\"")
41
- end
7
+ describe NCoverConsole, "when specifying assemblies to cover" do
8
+ before :all do
9
+ @testdata = NCoverConsoleTestData.new
10
+ File.delete(@testdata.xml_coverage_output) if File.exist?(@testdata.xml_coverage_output)
11
+
12
+ @ncc = NCoverConsole.new()
13
+
14
+ @ncc.extend(SystemPatch)
15
+ @ncc.log_level = :verbose
16
+ @ncc.path_to_command = @testdata.ncoverpath
17
+ @ncc.output :xml => @testdata.xml_coverage_output
18
+ @ncc.working_directory = @testdata.working_directory
19
+ @ncc.cover_assemblies "TestSolution"
20
+
21
+ nunit = NUnitTestRunner.new(@testdata.nunitpath)
22
+ nunit.assemblies @testdata.test_assembly
23
+ nunit.options '/noshadow'
24
+
25
+ @ncc.testrunner = nunit
26
+ @ncc.run
27
+ end
28
+
29
+ it "should provide coverage for the specified assemblies" do
30
+ @ncc.system_command.should include("//assemblies \"TestSolution\"")
31
+ end
42
32
  end
43
33
 
44
34
  describe NCoverConsole, "when specifying assemblies to ignore" do
45
- before :all do
46
- File.delete(@@xml_coverage_output) if File.exist?(@@xml_coverage_output)
47
-
48
- @ncc = NCoverConsole.new()
49
-
50
- @ncc.extend(SystemPatch)
51
- @ncc.log_level = :verbose
52
- @ncc.path_to_command = @@ncoverpath
53
- @ncc.output = {:xml => @@xml_coverage_output}
54
- @ncc.working_directory = @@working_directory
55
- @ncc.ignore_assemblies << "TestSolution.*"
56
-
57
- nunit = NUnitTestRunner.new(@@nunitpath)
58
- nunit.assemblies << @@test_assembly
59
- nunit.options << '/noshadow'
60
-
61
- @ncc.testrunner = nunit
62
- @ncc.run
63
- end
64
-
65
- it "should provide coverage for the specified assemblies" do
66
- @ncc.system_command.should include("//exclude-assemblies \"TestSolution.*\"")
67
- end
35
+ before :all do
36
+ @testdata = NCoverConsoleTestData.new
37
+ File.delete(@testdata.xml_coverage_output) if File.exist?(@testdata.xml_coverage_output)
38
+
39
+ @ncc = NCoverConsole.new()
40
+
41
+ @ncc.extend(SystemPatch)
42
+ @ncc.log_level = :verbose
43
+ @ncc.path_to_command = @testdata.ncoverpath
44
+ @ncc.output :xml => @testdata.xml_coverage_output
45
+ @ncc.working_directory = @testdata.working_directory
46
+ @ncc.ignore_assemblies "TestSolution.*"
47
+
48
+ nunit = NUnitTestRunner.new(@testdata.nunitpath)
49
+ nunit.assemblies @testdata.test_assembly
50
+ nunit.options '/noshadow'
51
+
52
+ @ncc.testrunner = nunit
53
+ @ncc.run
54
+ end
55
+
56
+ it "should provide coverage for the specified assemblies" do
57
+ @ncc.system_command.should include("//exclude-assemblies \"TestSolution.*\"")
58
+ end
59
+ end
60
+
61
+ describe NCoverConsole, "when running with the defaults" do
62
+ before :all do
63
+ @testdata = NCoverConsoleTestData.new
64
+ @ncc = NCoverConsole.new
65
+
66
+ @ncc.extend(SystemPatch)
67
+ @ncc.path_to_command = @testdata.ncoverpath
68
+ @ncc.testrunner = NUnitTestRunner.new
69
+
70
+ @ncc.run
71
+ end
72
+
73
+ it "should include the register flag in the command" do
74
+ @ncc.system_command.should include "//reg"
75
+ end
76
+ end
77
+
78
+ describe NCoverConsole, "when opting out of registering the ncover dll" do
79
+ before :all do
80
+ @testdata = NCoverConsoleTestData.new
81
+ @ncc = NCoverConsole.new
82
+
83
+ @ncc.extend(SystemPatch)
84
+ @ncc.path_to_command = @testdata.ncoverpath
85
+ @ncc.no_registration
86
+ @ncc.testrunner = NUnitTestRunner.new
87
+
88
+ @ncc.run
89
+ end
90
+
91
+ it "should not include the register flag in the command" do
92
+ @ncc.system_command.should_not include "//reg"
93
+ end
68
94
  end
69
95
 
70
96
  describe NCoverConsole, "when specifying the types of coverage to analyze" do
71
- before :all do
72
- File.delete(@@xml_coverage_output) if File.exist?(@@xml_coverage_output)
73
-
74
- @ncc = NCoverConsole.new()
75
-
76
- @ncc.extend(SystemPatch)
77
- @ncc.log_level = :verbose
78
- @ncc.path_to_command = @@ncoverpath
79
- @ncc.output = {:xml => @@xml_coverage_output}
80
- @ncc.working_directory = @@working_directory
81
- @ncc.coverage = [:Symbol, :Branch, :MethodVisits, :CyclomaticComplexity]
82
-
83
- nunit = NUnitTestRunner.new(@@nunitpath)
84
- nunit.assemblies << @@test_assembly
85
- nunit.options << '/noshadow'
86
-
87
- @ncc.testrunner = nunit
88
- @ncc.run
89
- end
90
-
91
- it "should only run coverage for those metrics" do
92
- @ncc.system_command.should include("//coverage-type \"Symbol, Branch, MethodVisits, CyclomaticComplexity\"")
93
- end
97
+ before :all do
98
+ @testdata = NCoverConsoleTestData.new
99
+ File.delete(@testdata.xml_coverage_output) if File.exist?(@testdata.xml_coverage_output)
100
+
101
+ @ncc = NCoverConsole.new()
102
+
103
+ @ncc.extend(SystemPatch)
104
+ @ncc.log_level = :verbose
105
+ @ncc.path_to_command = @testdata.ncoverpath
106
+ @ncc.output :xml => @testdata.xml_coverage_output
107
+ @ncc.working_directory = @testdata.working_directory
108
+ @ncc.coverage :Symbol, :Branch, :MethodVisits, :CyclomaticComplexity
109
+
110
+ nunit = NUnitTestRunner.new(@testdata.nunitpath)
111
+ nunit.assemblies @testdata.test_assembly
112
+ nunit.options '/noshadow'
113
+
114
+ @ncc.testrunner = nunit
115
+ @ncc.run
116
+ end
117
+
118
+ it "should only run coverage for those metrics" do
119
+ @ncc.system_command.should include("//coverage-type \"Symbol, Branch, MethodVisits, CyclomaticComplexity\"")
120
+ end
94
121
  end
95
122
 
96
123
  describe NCoverConsole, "when analyzing a test suite with failing tests" do
97
- before :all do
98
- File.delete(@@xml_coverage_output) if File.exist?(@@xml_coverage_output)
99
-
100
- ncc = NCoverConsole.new()
101
- strio = StringIO.new
102
- ncc.log_device = strio
103
-
104
- ncc.extend(SystemPatch)
105
- ncc.log_level = :verbose
106
- ncc.path_to_command = @@ncoverpath
107
- ncc.output = {:xml => @@xml_coverage_output}
108
- ncc.working_directory = @@working_directory
109
-
110
- nunit = NUnitTestRunner.new(@@nunitpath)
111
- nunit.assemblies << @@failing_test_assembly
112
- nunit.options << '/noshadow'
113
-
114
- ncc.testrunner = nunit
115
-
116
- ncc.run
117
- @failed = ncc.failed
118
- @log_data = strio.string
119
- end
120
-
121
- it "should return a failure code" do
122
- @failed.should == true
123
- end
124
-
125
- it "should log a failure message" do
126
- @log_data.should include("Code Coverage Analysis Failed. See Build Log For Detail.")
127
- end
124
+ before :all do
125
+ @testdata = NCoverConsoleTestData.new
126
+ File.delete(@testdata.xml_coverage_output) if File.exist?(@testdata.xml_coverage_output)
127
+
128
+ ncc = NCoverConsole.new()
129
+ strio = StringIO.new
130
+ ncc.log_device = strio
131
+
132
+ ncc.extend(SystemPatch)
133
+ ncc.log_level = :verbose
134
+ ncc.path_to_command = @testdata.ncoverpath
135
+ ncc.output :xml => @testdata.xml_coverage_output
136
+ ncc.working_directory = @testdata.working_directory
137
+
138
+ nunit = NUnitTestRunner.new(@testdata.nunitpath)
139
+ nunit.assemblies @testdata.failing_test_assembly
140
+ nunit.options '/noshadow'
141
+
142
+ ncc.testrunner = nunit
143
+
144
+ ncc.run
145
+ @failed = ncc.failed
146
+ @log_data = strio.string
147
+ end
148
+
149
+ it "should return a failure code" do
150
+ @failed.should == true
151
+ end
152
+
153
+ it "should log a failure message" do
154
+ @log_data.should include("Code Coverage Analysis Failed. See Build Log For Detail.")
155
+ end
128
156
  end
129
157
 
130
158
  describe NCoverConsole, "when running without a testrunner" do
131
- before :all do
132
- ncc = NCoverConsole.new()
133
- strio = StringIO.new
134
- ncc.log_device = strio
135
-
136
- @result = ncc.run
137
- @log_data = strio.string
138
- end
139
-
140
- it "should log a message saying the test runner is required" do
141
- @log_data.should include("testrunner cannot be nil.")
142
- end
143
-
144
- it "should return a failure code" do
145
- @result.should == false
146
- end
159
+ before :all do
160
+ @testdata = NCoverConsoleTestData.new
161
+ ncc = NCoverConsole.new()
162
+ strio = StringIO.new
163
+ ncc.log_device = strio
164
+
165
+ @result = ncc.run
166
+ @log_data = strio.string
167
+ end
168
+
169
+ it "should log a message saying the test runner is required" do
170
+ @log_data.should include("testrunner cannot be nil.")
171
+ end
172
+
173
+ it "should return a failure code" do
174
+ @result.should == false
175
+ end
147
176
  end
148
177
 
149
178
  describe NCoverConsole, "when producing an xml coverage report with nunit" do
150
- before :all do
151
- File.delete(@@xml_coverage_output) if File.exist?(@@xml_coverage_output)
152
-
153
- @ncc = NCoverConsole.new()
154
-
155
- @ncc.extend(SystemPatch)
156
- @ncc.log_level = :verbose
157
- @ncc.path_to_command = @@ncoverpath
158
- @ncc.output = {:xml => @@xml_coverage_output}
159
- @ncc.working_directory = @@working_directory
160
-
161
- nunit = NUnitTestRunner.new(@@nunitpath)
162
- nunit.assemblies << @@test_assembly
163
- nunit.options << '/noshadow'
164
-
165
- @ncc.testrunner = nunit
166
- @ncc.run
167
- end
168
-
169
- it "should execute ncover.console from the specified path" do
170
- @ncc.system_command.should include(@@ncoverpath)
171
- end
172
-
173
- it "should execute with the specified working directory" do
174
- @ncc.system_command.should include(@@working_directory)
175
- end
176
-
177
- it "should execute the test runner from the specified path" do
178
- @ncc.system_command.should include(@@nunitpath)
179
- end
180
-
181
- it "should pass the specified arguments to the test runner" do
182
- @ncc.system_command.should include("TestSolution.Tests.dll /noshadow")
183
- end
184
-
185
- it "should write the coverage data to the specified file" do
186
- File.exist?(@@xml_coverage_output).should == true
187
- end
179
+ before :all do
180
+ @testdata = NCoverConsoleTestData.new
181
+ File.delete(@testdata.xml_coverage_output) if File.exist?(@testdata.xml_coverage_output)
182
+
183
+ @ncc = NCoverConsole.new()
184
+
185
+ @ncc.extend(SystemPatch)
186
+ @ncc.log_level = :verbose
187
+ @ncc.path_to_command = @testdata.ncoverpath
188
+ @ncc.output :xml => @testdata.xml_coverage_output
189
+ @ncc.working_directory = @testdata.working_directory
190
+
191
+ nunit = NUnitTestRunner.new(@testdata.nunitpath)
192
+ nunit.assemblies @testdata.test_assembly
193
+ nunit.options '/noshadow'
194
+
195
+ @ncc.testrunner = nunit
196
+ @ncc.run
197
+ end
198
+
199
+ it "should execute ncover.console from the specified path" do
200
+ @ncc.system_command.should include(@testdata.ncoverpath)
201
+ end
202
+
203
+ it "should execute with the specified working directory" do
204
+ @ncc.system_command.should include(@testdata.working_directory)
205
+ end
206
+
207
+ it "should execute the test runner from the specified path" do
208
+ @ncc.system_command.should include(@testdata.nunitpath)
209
+ end
210
+
211
+ it "should pass the specified arguments to the test runner" do
212
+ @ncc.system_command.should include("TestSolution.Tests.dll /noshadow")
213
+ end
214
+
215
+ it "should write the coverage data to the specified file" do
216
+ File.exist?(@testdata.xml_coverage_output).should == true
217
+ end
188
218
  end
189
219
 
190
220
  describe NCoverConsole, "when specifying an html report and an xml coverage report with nunit" do
191
- before :all do
192
- File.delete(@@xml_coverage_output) if File.exist?(@@xml_coverage_output)
193
- File.delete(@@html_coverage_output) if File.exist?(@@html_coverage_output)
194
-
195
- ncc = NCoverConsole.new()
196
-
197
- ncc.extend(SystemPatch)
198
- ncc.log_level = :verbose
199
- ncc.path_to_command = @@ncoverpath
200
- ncc.output = {:xml => @@xml_coverage_output, :html => @@html_coverage_output}
201
- ncc.working_directory = @@working_directory
202
-
203
- nunit = NUnitTestRunner.new(@@nunitpath)
204
- nunit.assemblies << @@test_assembly
205
- nunit.options << '/noshadow'
206
-
207
- ncc.testrunner = nunit
208
- ncc.run
209
- end
210
-
211
-
212
- it "should produce the xml report" do
213
- File.exist?(@@xml_coverage_output).should == true
214
- end
215
-
216
- it "should produce the html report" do
217
- File.exist?(@@html_coverage_output).should == true
218
- end
221
+ before :all do
222
+ @testdata = NCoverConsoleTestData.new
223
+ File.delete(@testdata.xml_coverage_output) if File.exist?(@testdata.xml_coverage_output)
224
+ File.delete(@testdata.html_coverage_output) if File.exist?(@testdata.html_coverage_output)
225
+
226
+ ncc = NCoverConsole.new()
227
+
228
+ ncc.extend(SystemPatch)
229
+ ncc.log_level = :verbose
230
+ ncc.path_to_command = @testdata.ncoverpath
231
+ ncc.output :xml => @testdata.xml_coverage_output, :html => @testdata.html_coverage_output
232
+ ncc.working_directory = @testdata.working_directory
233
+
234
+ nunit = NUnitTestRunner.new(@testdata.nunitpath)
235
+ nunit.assemblies @testdata.test_assembly
236
+ nunit.options '/noshadow'
237
+
238
+ ncc.testrunner = nunit
239
+ ncc.run
240
+ end
241
+
242
+
243
+ it "should produce the xml report" do
244
+ File.exist?(@testdata.xml_coverage_output).should == true
245
+ end
246
+
247
+ it "should produce the html report" do
248
+ File.exist?(@testdata.html_coverage_output).should == true
249
+ end
219
250
  end
220
251
 
221
252
  describe NCoverConsole, "when producing a report with machine.specifications" do
222
- before :all do
223
- @ncc = NCoverConsole.new()
224
-
225
- @ncc.extend(SystemPatch)
226
- @ncc.log_level = :verbose
227
- @ncc.path_to_command = @@ncoverpath
228
- @ncc.output = {:xml => @@xml_coverage_output}
229
- @ncc.working_directory = @@working_directory
230
-
231
- mspec = MSpecTestRunner.new(@@mspecpath)
232
- mspec.assemblies << @@mspec_test_assembly
233
- mspec.html_output = @@mspec_html_output
234
-
235
- @ncc.testrunner = mspec
236
- @ncc.run
237
- end
238
-
239
- it "should not fail" do
240
- @ncc.failed.should be_false
241
- end
242
-
243
- it "should produce the html report" do
244
- File.exist?(@@mspec_html_output.to_s).should be_true
245
- end
246
-
247
- end
253
+ before :all do
254
+ @testdata = NCoverConsoleTestData.new
255
+ @ncc = NCoverConsole.new()
256
+
257
+ @ncc.extend(SystemPatch)
258
+ @ncc.log_level = :verbose
259
+ @ncc.path_to_command = @testdata.ncoverpath
260
+ @ncc.output :xml => @testdata.xml_coverage_output
261
+ @ncc.working_directory = @testdata.working_directory
262
+
263
+ mspec = MSpecTestRunner.new(@testdata.mspecpath)
264
+ mspec.assemblies @testdata.mspec_test_assembly
265
+ mspec.html_output = @testdata.mspec_html_output
266
+
267
+ @ncc.testrunner = mspec
268
+ @ncc.run
269
+ end
270
+
271
+ it "should not fail" do
272
+ @ncc.failed.should be_false
273
+ end
274
+
275
+ it "should produce the html report" do
276
+ File.exist?(@testdata.mspec_html_output.to_s).should be_true
277
+ end
278
+
279
+ end