ttcn3/lib/testlib.py: implement the concept of test case groups

Change-Id: I687c221e4a6c7232290509cb11a3158d72b9c2c3
This commit is contained in:
Vadim Yanitskiy 2020-08-06 01:53:24 +07:00
parent ed5c776100
commit d1cb75935a
3 changed files with 11 additions and 5 deletions

View File

@ -4,7 +4,9 @@ from mako.template import Template
from osmo_gsm_tester.testenv import *
def run_ttcn3(tenv, testdir, bts, osmocon, nat_rsl_ip, ttcn3_test_execute, ttcn3_test_extra_module_params=""):
def run_ttcn3(tenv, testdir, bts, osmocon, nat_rsl_ip,
ttcn3_test_groups = [],
ttcn3_test_extra_module_params=""):
own_dir = testdir
script_file = os.path.join(testdir, 'scripts', 'run_ttcn3_docker.sh')
bts_tmpl_file = os.path.join(testdir, 'scripts', 'BTS_Tests.cfg.tmpl')
@ -23,7 +25,7 @@ def run_ttcn3(tenv, testdir, bts, osmocon, nat_rsl_ip, ttcn3_test_execute, ttcn3
mytemplate = Template(filename=bts_tmpl_file)
r = mytemplate.render(btsvty_ctrl_hostname=bts.remote_addr(),
pcu_available=pcu_available,
ttcn3_test_execute=ttcn3_test_execute,
ttcn3_test_groups=ttcn3_test_groups,
ttcn3_test_extra_module_params=ttcn3_test_extra_module_params)
with open(bts_cfg_file, 'w') as f:
f.write(r)

View File

@ -29,4 +29,6 @@ ${ttcn3_test_extra_module_params}
[MAIN_CONTROLLER]
[EXECUTE]
${ttcn3_test_execute}
% for group in ttcn3_test_groups:
${group}.control
% endfor

View File

@ -6,7 +6,9 @@ import testlib
tenv.test_import_modules_register_for_cleanup(testlib)
from testlib import run_ttcn3
ttcn3_test_execute="BTS_Tests.control"
ttcn3_test_groups = [
'BTS_Tests',
]
hlr_dummy = tenv.hlr()
mgw_dummy = tenv.mgw()
@ -46,4 +48,4 @@ print('Starting osmocon')
osmocon.start()
testdir = os.path.dirname(os.path.realpath(__file__))
run_ttcn3(tenv, testdir, bts, osmocon, nat_rsl_ip, ttcn3_test_execute)
run_ttcn3(tenv, testdir, bts, osmocon, nat_rsl_ip, ttcn3_test_groups)