@@ -74,16 +74,18 @@ Define tests.
74
74
g.test_example_m = function() ... end
75
75
76
76
-- Define parametrized groups
77
- local pg = t.group('pgroup', t.helpers.matrix({param_1 = {1, 2}, param_2 = {3, 4}}))
78
- pg.test_example_1 = function(cg) ... end
79
- -- type(cg.params.param_1) == 'number'
80
- pg.test_example_n = function(cg) ... end
77
+ local pg = t.group('pgroup', {{engine = 'memtx'}, {engine = 'vinyl'}})
78
+ pg.test_example_3 = function(cg)
79
+ -- Use cg.params here
80
+ box.schema.space.create('test', {
81
+ engine = cg.params.engine,
82
+ })
83
+ end
81
84
82
85
-- Hooks can be specified for one parameter
83
- pg.before_all(function() ... end)
84
- pg.before_each({param_1 = 1}, function() ... end)
85
- pg.after_each({param_2 = 3}, function() ... end)
86
- pg.after_test('test_example_1', {param_1 = 2, param_2 = 4}, function() ... end)
86
+ pg.before_all({engine = 'memtx'}, function() ... end)
87
+ pg.before_each({engine = 'memtx'}, function() ... end)
88
+ pg.before_test('test_example_3', {engine = 'vinyl'}, function() ... end)
87
89
88
90
89
91
Run them.
@@ -258,17 +260,21 @@ Test group can be parametrized.
258
260
259
261
g.test_params = function(cg)
260
262
...
261
- local param_a_val = cg.params.a
262
- local param_b_val = cg.params.b
263
+ log.info('a = %s', cg.params.a)
264
+ log.info('b = %s', cg.params.b)
263
265
...
264
266
end
265
267
266
- Group can be parametrized with a matrix of parameters using helper.
268
+ Group can be parametrized with a matrix of parameters using ` luatest.helpers `:
267
269
268
270
.. code-block :: Lua
269
271
270
272
local g = t.group('pgroup', t.helpers.matrix({a = {1, 2}, b = {3, 4}}))
271
-
273
+ -- Will run:
274
+ -- * a = 1, b = 3
275
+ -- * a = 1, b = 4
276
+ -- * a = 2, b = 3
277
+ -- * a = 2, b = 4
272
278
273
279
Each test will be performed for every params combination. Hooks will work as usual
274
280
unless there are specified params. The order of execution in the hook group is
0 commit comments