config['debug_mode'] = True utils.print_log('scaning folder {}'.format( TEST_DIR)) for tfile in os.listdir(TEST_DIR): if tfile[0] != '.' and tfile[-1] != '~' and tfile[-1] != '~': utils.print_separator() msg = ColorText('trying to read file {}'.format( tfile), 'keywords') utils.print_log(msg) filename = '{0}/{1}'.format(TEST_DIR, tfile) try: tf = TestFile(filename) tf.print_file_info() tf.test_requests() except RestTestError as e: if e.code == 100003: msg = ColorText(e.message, 'warning') utils.print_log(e.message) else: raise e except Exception as e: raise e Expectation.print_summary(config['debug_mode']) except RestTestError as e: traceback.print_exc() utils.print_log(e.message) except: traceback.print_exc()
from testapp.models.error import RestTestError from testapp.models.testfile import TestFile from testapp.models.expectation import Expectation TEST_DIR = 'testfiles' if __name__ == '__main__': try: if not os.path.isdir(TEST_DIR): raise RestTestError('DIR_NOT_FOUND', dir=TEST_DIR) for tfile in os.listdir(TEST_DIR): filename = '{0}/{1}'.format(TEST_DIR, tfile) try: tf = TestFile(filename) tf.print_file_info() tf.test_requests() except RestTestError as e: if e.code == 100003: utils.print_log(e.message) utils.print_log('skipped!') else: raise e utils.print_log('='*80) Expectation.print_summary() except RestTestError as e: utils.print_log(e.message) except: traceback.print_exc()