aboutsummaryrefslogtreecommitdiffstats
path: root/functest/core/feature.py
AgeCommit message (Collapse)AuthorFilesLines
2018-02-09Unlink feature from constantsCédric Ollivier1-3/+2
Saving results dir as class attribute seems better in the context of xtesting. Change-Id: If40303d07d3be9bdc09d990f560cbeda429fd642 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-12-27Execute feature command by subprocess directlyLinda Wang1-4/+7
Change-Id: I77e86af4e96310c6520d743e4d16c9a7b2e9adf5 Signed-off-by: Linda Wang <wangwulin@huawei.com>
2017-12-20Remove logger_test_resultsCédric Ollivier1-3/+0
It was only called in Feature which the result is already printed (see __str__()). It also eases moving Feature to xtesting as it breaks the link to functest_utils. Change-Id: Ib72d651dc7d89598704ff4d52d8b1ecb2bdade5b Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-06-21Define logger as Feature instance attributeJose Lausuch1-0/+18
It allows any Feature subclass to print warning messages in console and debug messages in a dedicated file. Co-Authored-By: Cédric Ollivier <cedric.ollivier@orange.com> Change-Id: Ic5b1b1184c16cf50f0baadc3904075d0acdf3c6d Signed-off-by: Jose Lausuch <jose.lausuch@ericsson.com> Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-05-23Add docstrings in unitCédric Ollivier1-1/+1
It also adds shebang and conforms the copyright header with the related OPNFV template. Change-Id: Iacb0cc8629e3021181eef2e8cb76daf48601abf4 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-05-16Switch from generate_report to PrettyTableCédric Ollivier1-1/+0
run_tests.py now relies on PrettyTable as most of the openstack clients. generate_report.py and its related unit tests are simply removed. It sets padding_width=5 in testcase.py too to conform with run_tests.py. Now report is printed in every case. Change-Id: Id9ce93f984503f25d6a2150482f397853fa3dd64 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-05-05Replace project_name by case_name in result file nameCédric Ollivier1-1/+1
It avoids erasing functest.log when project_name = functest. Change-Id: Icae898abb8b51c89b79bb1124adfadab8b0b3b99 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-05-04Define loggers as class-private membersCédric Ollivier1-6/+8
This mangling ensures that all info messages printed from core packages are shown in console. It also avoids sphinx to print them. Change-Id: I07db9f33060c195bce3b48b06a6640eb6c56c2eb Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-05-04Delete functest.utils.functest_loggerCédric Ollivier1-2/+3
It deletes functest.utils.functest_logger and the related unit tests. Then it modifies all functest modules to get all loggers via logging.getLogger(). __name__ is mainly used as getLogger arg as proposed by logging [1]. All loggers and handlers are now defined via functest/ci/logging.ini instead of a dict loaded by an external json file. Now only warn messages and info messages from ci and core packages are printed in console. [1] https://docs.python.org/2/library/logging.html Change-Id: Ic192855e0f9bf94825d8f7ec73549a0f3b8d44c5 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-04-26Manage criteria in TestCaseCédric Ollivier1-2/+2
It converts all criteria values to the corresponding percent in functest/ci/testcases.yaml. Result is expected to be equal or greater than criteria. If both are 0, result is considered as false. It is compatible with the old behavior but warns to update. It will allow a safer remove. It also fixes a bug in test_tempest to allow merging [1] and tier_handler.py which required that type criteria was str. [1] https://gerrit.opnfv.org/gerrit/#/c/27949/ Change-Id: Ib6edcfa3103b7d51b0bdc83119f1cea2a8be9fbc Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-04-26Switch TestCase attribute criteria to resultCédric Ollivier1-5/+5
It mainly avoids mixing input and output. Criteria is now an input set in functest/ci/testcases.yaml and then must be passed as __init__() args (which will be proposed in an additional change). Then it also renames the related TestCase method to check_result(). Change-Id: Ifc3c8e3ea6cde7e3edf7174bed4bf2bf0894e8e3 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-04-21Switch testcase to test case in docstringsCédric Ollivier1-1/+1
Change-Id: Iea64673788a3d5ab5eb3028522f659de183440ed Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-04-20Minor changes in docstringsCédric Ollivier1-5/+7
It removes case_name from the list of attributes that run() must set because it's now managed by run_tests.py (see __init__()) Change-Id: Id6228880257d0e9fb27483c56aa9985197feb04e Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-04-18Add docstings in feature.pyCédric Ollivier1-0/+52
It also modifies the testcase module docstring. Now features.py is rated 10/10 by pylint. Change-Id: I83f2ac385b2a713d116c1ae4b49ba9cc9b26a83c Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-04-18Remove former cmd instance attributeCédric Ollivier1-1/+0
It's now useless as it's passed as run() args. Change-Id: I97e14bd431a8844cd90905bf2050c48fb00f1cc5 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-04-14Add license in feature.pySerenaFeng1-0/+7
Change-Id: I75f51f216dcbf0db1c563cf381c28efc47241d3c Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
2017-04-14Remove deprecated feature modulesCédric Ollivier1-3/+13
All features running bash programs are now simply defined in testcases.yaml. All deprecated modules and unit tests are removed. Change-Id: I7047b6f7a1e43cb8ed5ba2d569d5dcecae68fb86 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-04-12Refactor the Feature frameworkCédric Ollivier1-42/+24
run() returns the expected status code (see following JIRA tickets). repo, pre() and post() are removed as they were quite useless. A dedicated class is proposed for bash programs. Unit tests have been added to fully cover this module. All features have been modified to conform with these modifications. It also removes the decorators which skipped several unit tests. JIRA: FUNCTEST-778 JIRA: FUNCTEST-779 JIRA: FUNCTEST-780 JIRA: FUNCTEST-781 Change-Id: Ifb1e4c4f68260a4e20d895f67f07f369ca959374 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-04-11Modify TestCase constructor attributesCédric Ollivier1-5/+5
Every feature/testcase now allows receiving the data defined in testcases.yaml as args (name is renamed to case_name). From the time being, only project and case names are handled. Next pending patches will add criteria, cmd and repo to this list. It keeps the default values for case names except for features which will be aggregated into Feature. Change-Id: Id742d100b8183d7f10894c24ae6879d1b2b60ac9 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-04-04Add case_name as constructor argCédric Ollivier1-3/+2
It allows managing multiple TestCase names with only one TestCase module. It is mainly required by odl which implements: - odl, - odl_netvirt, - fds. It also renames case to case_name in Features to conform with TestCases. JIRA: FUNCTEST-762 Change-Id: Ie254f754a0ea3077a8afda1c470528d38c79478f Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
2017-03-28rename FeatureBase to FeatureSerenaFeng1-2/+2
delete useless suffix 'Base' Change-Id: Ie789da2e83cc90585fd281fe183e8430af498436 Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
2017-03-28rename feature_base to featureSerenaFeng1-0/+63
remove useless suffix _base Change-Id: I63a73fd6fef2fccd9b92c405f64dda50735b0026 Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>