Skip to content

Commit 1369d34

Browse files
committed
✨ Added extra parameterizedTests function with X arguments.
1 parent 5ccbef4 commit 1369d34

File tree

3 files changed

+375
-3
lines changed

3 files changed

+375
-3
lines changed

lib/src/parameterized_test_base.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import 'value_source.dart';
2424
/// );
2525
/// ```
2626
@isTestGroup
27-
//ignore: long-parameter-list
2827
void parameterizedTest(
2928
/// Test description.
3029
Object description,
@@ -83,7 +82,6 @@ void parameterizedTest(
8382
/// );
8483
/// ```
8584
@isTestGroup
86-
//ignore: long-parameter-list
8785
void parameterizedGroup(
8886
/// Group description.
8987
Object description,
Lines changed: 374 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,374 @@
1+
import 'package:meta/meta.dart';
2+
import 'package:test/test.dart';
3+
4+
import '../parameterized_test.dart';
5+
6+
/// Parameterized test with 1 input arguments. See [parameterizedTest] for more info.
7+
@isTestGroup
8+
void parameterizedTest1<A1>(
9+
/// Test description.
10+
Object description,
11+
12+
/// List of test values. For each values in the list a test will be executed.
13+
Iterable<dynamic> values,
14+
15+
/// The test body which is executed for each test value.
16+
/// See [TestParameters] for more info on different bodies.
17+
dynamic Function(A1) body, {
18+
dynamic Function()? setUp,
19+
20+
/// Provide a tearDown function to the `group` test.
21+
dynamic Function()? tearDown,
22+
String? testOn,
23+
Timeout? timeout,
24+
dynamic skip,
25+
dynamic tags,
26+
Map<String, dynamic>? onPlatform,
27+
int? retry,
28+
}) =>
29+
parameterizedTest(
30+
description,
31+
values,
32+
p1(body),
33+
setUp: setUp,
34+
tearDown: tearDown,
35+
testOn: testOn,
36+
timeout: timeout,
37+
skip: skip,
38+
tags: tags,
39+
onPlatform: onPlatform,
40+
retry: retry,
41+
);
42+
43+
/// Parameterized test with 2 input arguments. See [parameterizedTest] for more info.
44+
@isTestGroup
45+
void parameterizedTest2<A1, A2>(
46+
/// Test description.
47+
Object description,
48+
49+
/// List of test values. For each values in the list a test will be executed.
50+
Iterable<dynamic> values,
51+
52+
/// The test body which is executed for each test value.
53+
/// See [TestParameters] for more info on different bodies.
54+
dynamic Function(A1, A2) body, {
55+
dynamic Function()? setUp,
56+
57+
/// Provide a tearDown function to the `group` test.
58+
dynamic Function()? tearDown,
59+
String? testOn,
60+
Timeout? timeout,
61+
dynamic skip,
62+
dynamic tags,
63+
Map<String, dynamic>? onPlatform,
64+
int? retry,
65+
}) =>
66+
parameterizedTest(
67+
description,
68+
values,
69+
p2(body),
70+
setUp: setUp,
71+
tearDown: tearDown,
72+
testOn: testOn,
73+
timeout: timeout,
74+
skip: skip,
75+
tags: tags,
76+
onPlatform: onPlatform,
77+
retry: retry,
78+
);
79+
80+
/// Parameterized test with 3 input arguments. See [parameterizedTest] for more info.
81+
@isTestGroup
82+
void parameterizedTest3<A1, A2, A3>(
83+
/// Test description.
84+
Object description,
85+
86+
/// List of test values. For each values in the list a test will be executed.
87+
Iterable<dynamic> values,
88+
89+
/// The test body which is executed for each test value.
90+
/// See [TestParameters] for more info on different bodies.
91+
dynamic Function(A1, A2, A3) body, {
92+
dynamic Function()? setUp,
93+
94+
/// Provide a tearDown function to the `group` test.
95+
dynamic Function()? tearDown,
96+
String? testOn,
97+
Timeout? timeout,
98+
dynamic skip,
99+
dynamic tags,
100+
Map<String, dynamic>? onPlatform,
101+
int? retry,
102+
}) =>
103+
parameterizedTest(
104+
description,
105+
values,
106+
p3(body),
107+
setUp: setUp,
108+
tearDown: tearDown,
109+
testOn: testOn,
110+
timeout: timeout,
111+
skip: skip,
112+
tags: tags,
113+
onPlatform: onPlatform,
114+
retry: retry,
115+
);
116+
117+
/// Parameterized test with 4 input arguments. See [parameterizedTest] for more info.
118+
@isTestGroup
119+
void parameterizedTest4<A1, A2, A3, A4>(
120+
/// Test description.
121+
Object description,
122+
123+
/// List of test values. For each values in the list a test will be executed.
124+
Iterable<dynamic> values,
125+
126+
/// The test body which is executed for each test value.
127+
/// See [TestParameters] for more info on different bodies.
128+
dynamic Function(A1, A2, A3, A4) body, {
129+
dynamic Function()? setUp,
130+
131+
/// Provide a tearDown function to the `group` test.
132+
dynamic Function()? tearDown,
133+
String? testOn,
134+
Timeout? timeout,
135+
dynamic skip,
136+
dynamic tags,
137+
Map<String, dynamic>? onPlatform,
138+
int? retry,
139+
}) =>
140+
parameterizedTest(
141+
description,
142+
values,
143+
p4(body),
144+
setUp: setUp,
145+
tearDown: tearDown,
146+
testOn: testOn,
147+
timeout: timeout,
148+
skip: skip,
149+
tags: tags,
150+
onPlatform: onPlatform,
151+
retry: retry,
152+
);
153+
154+
/// Parameterized test with 5 input arguments. See [parameterizedTest] for more info.
155+
@isTestGroup
156+
void parameterizedTest5<A1, A2, A3, A4, A5>(
157+
/// Test description.
158+
Object description,
159+
160+
/// List of test values. For each values in the list a test will be executed.
161+
Iterable<dynamic> values,
162+
163+
/// The test body which is executed for each test value.
164+
/// See [TestParameters] for more info on different bodies.
165+
dynamic Function(A1, A2, A3, A4, A5) body, {
166+
dynamic Function()? setUp,
167+
168+
/// Provide a tearDown function to the `group` test.
169+
dynamic Function()? tearDown,
170+
String? testOn,
171+
Timeout? timeout,
172+
dynamic skip,
173+
dynamic tags,
174+
Map<String, dynamic>? onPlatform,
175+
int? retry,
176+
}) =>
177+
parameterizedTest(
178+
description,
179+
values,
180+
p5(body),
181+
setUp: setUp,
182+
tearDown: tearDown,
183+
testOn: testOn,
184+
timeout: timeout,
185+
skip: skip,
186+
tags: tags,
187+
onPlatform: onPlatform,
188+
retry: retry,
189+
);
190+
191+
/// Parameterized test with 6 input arguments. See [parameterizedTest] for more info.
192+
@isTestGroup
193+
void parameterizedTest6<A1, A2, A3, A4, A5, A6>(
194+
/// Test description.
195+
Object description,
196+
197+
/// List of test values. For each values in the list a test will be executed.
198+
Iterable<dynamic> values,
199+
200+
/// The test body which is executed for each test value.
201+
/// See [TestParameters] for more info on different bodies.
202+
dynamic Function(A1, A2, A3, A4, A5, A6) body, {
203+
dynamic Function()? setUp,
204+
205+
/// Provide a tearDown function to the `group` test.
206+
dynamic Function()? tearDown,
207+
String? testOn,
208+
Timeout? timeout,
209+
dynamic skip,
210+
dynamic tags,
211+
Map<String, dynamic>? onPlatform,
212+
int? retry,
213+
}) =>
214+
parameterizedTest(
215+
description,
216+
values,
217+
p6(body),
218+
setUp: setUp,
219+
tearDown: tearDown,
220+
testOn: testOn,
221+
timeout: timeout,
222+
skip: skip,
223+
tags: tags,
224+
onPlatform: onPlatform,
225+
retry: retry,
226+
);
227+
228+
/// Parameterized test with 7 input arguments. See [parameterizedTest] for more info.
229+
@isTestGroup
230+
void parameterizedTest7<A1, A2, A3, A4, A5, A6, A7>(
231+
/// Test description.
232+
Object description,
233+
234+
/// List of test values. For each values in the list a test will be executed.
235+
Iterable<dynamic> values,
236+
237+
/// The test body which is executed for each test value.
238+
/// See [TestParameters] for more info on different bodies.
239+
dynamic Function(A1, A2, A3, A4, A5, A6, A7) body, {
240+
dynamic Function()? setUp,
241+
242+
/// Provide a tearDown function to the `group` test.
243+
dynamic Function()? tearDown,
244+
String? testOn,
245+
Timeout? timeout,
246+
dynamic skip,
247+
dynamic tags,
248+
Map<String, dynamic>? onPlatform,
249+
int? retry,
250+
}) =>
251+
parameterizedTest(
252+
description,
253+
values,
254+
p7(body),
255+
setUp: setUp,
256+
tearDown: tearDown,
257+
testOn: testOn,
258+
timeout: timeout,
259+
skip: skip,
260+
tags: tags,
261+
onPlatform: onPlatform,
262+
retry: retry,
263+
);
264+
265+
/// Parameterized test with 8 input arguments. See [parameterizedTest] for more info.
266+
@isTestGroup
267+
void parameterizedTest8<A1, A2, A3, A4, A5, A6, A7, A8>(
268+
/// Test description.
269+
Object description,
270+
271+
/// List of test values. For each values in the list a test will be executed.
272+
Iterable<dynamic> values,
273+
274+
/// The test body which is executed for each test value.
275+
/// See [TestParameters] for more info on different bodies.
276+
dynamic Function(A1, A2, A3, A4, A5, A6, A7, A8) body, {
277+
dynamic Function()? setUp,
278+
279+
/// Provide a tearDown function to the `group` test.
280+
dynamic Function()? tearDown,
281+
String? testOn,
282+
Timeout? timeout,
283+
dynamic skip,
284+
dynamic tags,
285+
Map<String, dynamic>? onPlatform,
286+
int? retry,
287+
}) =>
288+
parameterizedTest(
289+
description,
290+
values,
291+
p8(body),
292+
setUp: setUp,
293+
tearDown: tearDown,
294+
testOn: testOn,
295+
timeout: timeout,
296+
skip: skip,
297+
tags: tags,
298+
onPlatform: onPlatform,
299+
retry: retry,
300+
);
301+
302+
/// Parameterized test with 9 input arguments. See [parameterizedTest] for more info.
303+
@isTestGroup
304+
void parameterizedTest9<A1, A2, A3, A4, A5, A6, A7, A8, A9>(
305+
/// Test description.
306+
Object description,
307+
308+
/// List of test values. For each values in the list a test will be executed.
309+
Iterable<dynamic> values,
310+
311+
/// The test body which is executed for each test value.
312+
/// See [TestParameters] for more info on different bodies.
313+
dynamic Function(A1, A2, A3, A4, A5, A6, A7, A8, A9) body, {
314+
dynamic Function()? setUp,
315+
316+
/// Provide a tearDown function to the `group` test.
317+
dynamic Function()? tearDown,
318+
String? testOn,
319+
Timeout? timeout,
320+
dynamic skip,
321+
dynamic tags,
322+
Map<String, dynamic>? onPlatform,
323+
int? retry,
324+
}) =>
325+
parameterizedTest(
326+
description,
327+
values,
328+
p9(body),
329+
setUp: setUp,
330+
tearDown: tearDown,
331+
testOn: testOn,
332+
timeout: timeout,
333+
skip: skip,
334+
tags: tags,
335+
onPlatform: onPlatform,
336+
retry: retry,
337+
);
338+
339+
/// Parameterized test with 10 input arguments. See [parameterizedTest] for more info.
340+
@isTestGroup
341+
void parameterizedTest10<A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>(
342+
/// Test description.
343+
Object description,
344+
345+
/// List of test values. For each values in the list a test will be executed.
346+
Iterable<dynamic> values,
347+
348+
/// The test body which is executed for each test value.
349+
/// See [TestParameters] for more info on different bodies.
350+
dynamic Function(A1, A2, A3, A4, A5, A6, A7, A8, A9, A10) body, {
351+
dynamic Function()? setUp,
352+
353+
/// Provide a tearDown function to the `group` test.
354+
dynamic Function()? tearDown,
355+
String? testOn,
356+
Timeout? timeout,
357+
dynamic skip,
358+
dynamic tags,
359+
Map<String, dynamic>? onPlatform,
360+
int? retry,
361+
}) =>
362+
parameterizedTest(
363+
description,
364+
values,
365+
p10(body),
366+
setUp: setUp,
367+
tearDown: tearDown,
368+
testOn: testOn,
369+
timeout: timeout,
370+
skip: skip,
371+
tags: tags,
372+
onPlatform: onPlatform,
373+
retry: retry,
374+
);

lib/src/test_source.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import 'test_parameters.dart';
22

3-
abstract class TestSource {
3+
abstract interface class TestSource {
44
void executeTests(TestParameters body);
55
void executeGroup(TestParameters body);
66
}

0 commit comments

Comments
 (0)