1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
#! /bin/sh /usr/share/dpatch/dpatch-run
## 06_nunit_2.4.dpatch by Jelmer Vernooij <jelmer@samba.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Update NUnit task to work with NUnit 2.4.7
@DPATCH@
diff -ur nant-0.85/src/NAnt.NUnit/NUnit2/NUnit2Task.cs nant-0.85.dfsg1-newnunit/src/NAnt.NUnit/NUnit2/NUnit2Task.cs
--- nant-0.85/src/NAnt.NUnit/NUnit2/NUnit2Task.cs 2006-04-23 19:53:12.000000000 +0200
+++ nant-0.85.dfsg1-newnunit/src/NAnt.NUnit/NUnit2/NUnit2Task.cs 2008-06-14 16:50:35.000000000 +0200
@@ -31,6 +31,7 @@
using System.Xml.XPath;
using NUnit.Core;
+using NUnit.Core.Filters;
using TestCase = NUnit.Core.TestCase;
using TestOutput = NUnit.Core.TestOutput;
using NUnit.Framework;
@@ -185,16 +186,16 @@
EventListener listener = new EventCollector(logWriter, logWriter);
foreach (NUnit2Test testElement in Tests) {
- IFilter categoryFilter = null;
+ ITestFilter categoryFilter = null;
// include or exclude specific categories
string categories = testElement.Categories.Includes.ToString();
if (!StringUtils.IsNullOrEmpty(categories)) {
- categoryFilter = new CategoryFilter(categories.Split(','), false);
+ categoryFilter = new CategoryFilter(categories.Split(','));
} else {
categories = testElement.Categories.Excludes.ToString();
if (!StringUtils.IsNullOrEmpty(categories)) {
- categoryFilter = new CategoryFilter(categories.Split(','), true);
+ categoryFilter = new NotFilter(new CategoryFilter(categories.Split(',')));
}
}
@@ -203,27 +204,22 @@
try {
TestRunner runner = domain.CreateRunner(new FileInfo(testAssembly), testElement.AppConfigFile);
+ TestPackage package = new TestPackage(testAssembly);
- Test test = null;
- if (testElement.TestName != null) {
- test = runner.Load(testAssembly, testElement.TestName);
- } else {
- test = runner.Load(testAssembly);
- }
-
- if (test == null) {
+ bool test = runner.Load(package);
+ if (!test) {
Log(Level.Warning, "Assembly \"{0}\" contains no tests.",
testAssembly);
continue;
}
- // set category filter
- if (categoryFilter != null) {
- runner.Filter = categoryFilter;
- }
-
+ TestResult result;
// run test
- TestResult result = runner.Run(listener);
+ if (categoryFilter != null) {
+ result = runner.Run(listener, categoryFilter);
+ } else {
+ result = runner.Run(listener);
+ }
// flush test output to log
logWriter.Flush();
@@ -371,7 +367,7 @@
#endregion Private Instance Methods
- private class EventCollector : LongLivingMarshalByRefObject, EventListener {
+ private class EventCollector : MarshalByRefObject, EventListener {
private TextWriter outWriter;
private TextWriter errorWriter;
private string currentTestName;
@@ -382,10 +378,10 @@
this.currentTestName = string.Empty;
}
- public void RunStarted(Test[] tests) {
+ public void RunStarted(string name, int testcount) {
}
- public void RunFinished(TestResult[] results) {
+ public void RunFinished(TestResult result) {
}
public void RunFinished(Exception exception) {
@@ -395,11 +391,11 @@
currentTestName = string.Empty;
}
- public void TestStarted(TestCase testCase) {
- currentTestName = testCase.FullName;
+ public void TestStarted(TestName testName) {
+ currentTestName = testName.FullName;
}
- public void SuiteStarted(TestSuite suite) {
+ public void SuiteStarted(TestName testName) {
}
public void SuiteFinished(TestSuiteResult suiteResult) {
@@ -423,4 +419,4 @@
}
}
}
-}
\ Kein Zeilenumbruch am Dateiende.
+}
|