-
Notifications
You must be signed in to change notification settings - Fork 31
/
package-tests.cake
205 lines (171 loc) · 8.3 KB
/
package-tests.cake
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
public static List<PackageTest> PackageTests = new List<PackageTest>();
public static void DefinePackageTests()
{
if (BuildSettings.Context == null)
throw new Exception("Trying to use BuildSettings before it is initialized");
// Define Package Tests
// Level 1 tests are run each time we build the packages
// Level 2 tests are run for PRs and when packages will be published
// Level 3 tests are run only when publishing a release
// Tests of single assemblies targeting each runtime we support
PackageTests.Add(new PackageTest(1, "Net462Test", "Run net462 mock-assembly.dll under .NET 4.6.2",
"net462/mock-assembly.dll",
MockAssemblyExpectedResult("Net462AgentLauncher")));
PackageTests.Add(new PackageTest(1, "Net462X86Test", "Run net462 mock-assembly-x86.dll under .NET 4.6.2",
"net462/mock-assembly-x86.dll",
MockAssemblyX86ExpectedResult("Net462AgentLauncher")));
PackageTests.Add(new PackageTest(1, "Net35Test", "Run net35 mock-assembly.dll under .NET 4.6.2",
"net35/mock-assembly.dll",
MockAssemblyExpectedResult("Net462AgentLauncher")));
PackageTests.Add(new PackageTest(1, "Net35X86Test", "Run net35 mock-assembly-x86.dll under .NET 4.6.2",
"net35/mock-assembly-x86.dll",
MockAssemblyX86ExpectedResult("Net462AgentLauncher")));
if (BuildSettings.IsLocalBuild)
{
PackageTests.Add(new PackageTest(1, "NetCore21Test", "Run .NET Core 2.1 mock-assembly.dll under .NET Core 3.1",
"netcoreapp2.1/mock-assembly.dll",
MockAssemblyExpectedResult("Net60AgentLauncher")));
PackageTests.Add(new PackageTest(1, "NetCore31Test", "Run mock-assembly.dll under .NET Core 3.1",
"netcoreapp3.1/mock-assembly.dll",
MockAssemblyExpectedResult("Net60AgentLauncher")));
}
// PackageTests.Add(new PackageTest(1, "NetCore11Test", "Run mock-assembly.dll targeting .NET Core 1.1",
// "netcoreapp1.1/mock-assembly.dll",
// new ExpectedResult("Failed")
// {
//Total = 41,
//Passed = 22,
//Failed = 7,
//Warnings = 0,
//Inconclusive = 5,
//Skipped = 7,
//Assemblies = new[] { new ExpectedAssemblyResult("mock-assembly.dll", "netcore-1.1") }
// }));
if (BuildSettings.IsLocalBuild)
PackageTests.Add(new PackageTest(1, "Net50Test", "Run mock-assembly.dll under .NET 5.0",
"net5.0/mock-assembly.dll",
MockAssemblyExpectedResult("Net60AgentLauncher")));
PackageTests.Add(new PackageTest(1, "Net60Test", "Run mock-assembly.dll under .NET 6.0",
"net6.0/mock-assembly.dll",
MockAssemblyExpectedResult("Net60AgentLauncher")));
PackageTests.Add(new PackageTest(1, "Net70Test", "Run mock-assembly.dll under .NET 7.0",
"net7.0/mock-assembly.dll",
MockAssemblyExpectedResult("Net70AgentLauncher")));
PackageTests.Add(new PackageTest(1, "Net80Test", "Run mock-assembly.dll under .NET 8.0",
"net8.0/mock-assembly.dll --trace:Debug",
MockAssemblyExpectedResult("Net80AgentLauncher")));
// AspNetCore tests
if (BuildSettings.IsLocalBuild)
{
PackageTests.Add(new PackageTest(1, "AspNetCore31Test", "Run test using AspNetCore under .NET Core 3.1",
"netcoreapp3.1/aspnetcore-test.dll",
new ExpectedResult("Passed")
{
Assemblies = new[] { new ExpectedAssemblyResult("aspnetcore-test.dll", "Net60AgentLauncher") }
}));
PackageTests.Add(new PackageTest(1, "AspNetCore50Test", "Run test using AspNetCore under .NET 5.0",
"net5.0/aspnetcore-test.dll",
new ExpectedResult("Passed")
{
Assemblies = new[] { new ExpectedAssemblyResult("aspnetcore-test.dll", "Net60AgentLauncher") }
}));
}
PackageTests.Add(new PackageTest(1, "AspNetCore60Test", "Run test using AspNetCore under .NET 6.0",
"net6.0/aspnetcore-test.dll",
new ExpectedResult("Passed")
{
Assemblies = new [] { new ExpectedAssemblyResult("aspnetcore-test.dll", "Net60AgentLauncher") }
}));
PackageTests.Add(new PackageTest(1, "AspNetCore70Test", "Run test using AspNetCore under .NET 7.0",
"net7.0/aspnetcore-test.dll",
new ExpectedResult("Passed")
{
Assemblies = new [] { new ExpectedAssemblyResult("aspnetcore-test.dll", "Net70AgentLauncher") }
}));
// Windows Forms Tests
if (BuildSettings.IsLocalBuild)
PackageTests.Add(new PackageTest(1, "Net50WindowsFormsTest", "Run test using windows forms under .NET 5.0",
"net5.0-windows/windows-forms-test.dll",
new ExpectedResult("Passed")
{
Assemblies = new [] { new ExpectedAssemblyResult("windows-forms-test.dll", "Net60AgentLauncher") }
}));
PackageTests.Add(new PackageTest(1, "Net60WindowsFormsTest", "Run test using windows forms under .NET 6.0",
"net6.0-windows/windows-forms-test.dll",
new ExpectedResult("Passed")
{
Assemblies = new [] { new ExpectedAssemblyResult("windows-forms-test.dll", "Net60AgentLauncher") }
}));
PackageTests.Add(new PackageTest(1, "Net70WindowsFormsTest", "Run test using windows forms under .NET 7.0",
"net7.0-windows/windows-forms-test.dll",
new ExpectedResult("Passed")
{
Assemblies = new [] { new ExpectedAssemblyResult("windows-forms-test.dll", "Net70AgentLauncher") }
}));
// Multiple assembly tests
PackageTests.Add(new PackageTest(1, "Net462PlusNet35Test", "Run .NET 4.6.2 and .NET 3.5 builds of mock-assembly.dll together",
"net462/mock-assembly.dll net35/mock-assembly.dll",
MockAssemblyExpectedResult("Net462AgentLauncher", "Net462AgentLauncher")));
PackageTests.Add(new PackageTest(1, "Net462PlusNet60Test", "Run .NET 4.6.2 and .NET 6.0 builds of mock-assembly.dll together",
"net462/mock-assembly.dll net6.0/mock-assembly.dll",
MockAssemblyExpectedResult("Net462AgentLauncher", "Net60AgentLauncher")));
// TODO: Suppress V2 tests until driver is working
//PackageTests.Add(new PackageTest(1, "NUnitV2Test", "Run mock-assembly.dll built for NUnit V2",
// "v2-tests/mock-assembly.dll",
// new ExpectedResult("Failed")
// {
// Total = 28,
// Passed = 18,
// Failed = 5,
// Warnings = 0,
// Inconclusive = 1,
// Skipped = 4
// },
// EngineExtensions.NUnitV2Driver));
// TODO: Use --config option when it's supported by the extension.
// Current test relies on the fact that the Release config appears
// first in the project file.
// Completely suppressed for the time being
//if (BuildSettings.Configuration == "Release")
//{
// PackageTests.Add(new PackageTest(1, "NUnitProjectTest", "Run an NUnit project",
// "../../TestProject.nunit --trace:Debug",
// MockAssemblyExpectedResult(
// "Net462AgentLauncher", "Net462AgentLauncher", "Net60AgentLauncher", "Net60AgentLauncher"),
// NUnitProjectLoader));
//}
ExpectedResult MockAssemblyExpectedResult(params string[] agentNames)
{
int ncopies = agentNames.Length;
var assemblies = new ExpectedAssemblyResult[ncopies];
for (int i = 0; i < ncopies; i++)
assemblies[i] = new ExpectedAssemblyResult("mock-assembly.dll", agentNames[i]);
return new ExpectedResult("Failed")
{
Total = 41 * ncopies,
Passed = 22 * ncopies,
Failed = 7 * ncopies,
Warnings = 0 * ncopies,
Inconclusive = 5 * ncopies,
Skipped = 7 * ncopies,
Assemblies = assemblies
};
}
ExpectedResult MockAssemblyX86ExpectedResult(params string[] agentNames)
{
int ncopies = agentNames.Length;
var assemblies = new ExpectedAssemblyResult[ncopies];
for (int i = 0; i < ncopies; i++)
assemblies[i] = new ExpectedAssemblyResult("mock-assembly-x86.dll", agentNames[i]);
return new ExpectedResult("Failed")
{
Total = 31 * ncopies,
Passed = 18 * ncopies,
Failed = 5 * ncopies,
Warnings = 0 * ncopies,
Inconclusive = 1 * ncopies,
Skipped = 7 * ncopies,
Assemblies = assemblies
};
}
}