# # ---------------------------------------------------------- """ This program is created for the business-test on the level of unit testing. On this level there is an intensive test-set up to a carthesian product possible. The test-specification is written in a yaml-config in the data-directory. workflow: 1. generate test-cases with all inputs into a csv-file of the spec-yaml 2. run the csv-file and collect all results into a new result-csv-file with all inputs and outputs 3. check the result-csv-file and declare it as a target-results OR instead 2 and 3 on test-first-strategy: 3. create manually the target-result with your inputs and the target system-outputs 4. run and compare the actual-result with the target-result 5. at the end you get an xls-sheet like your result-csv-file but additionally with comparsion-result as detailed result and the only counts of passed and failed tests as minimum-result which can be inserted into management-tools """ # Press the green button in the gutter to run the script. import importlib import unittest import test.constants import os, glob HOME_PATH = test.constants.HOME_PATH VERIFY = False class MyTestLoader(unittest.TestLoader): def start_testcases(self): pass def create_test_suite(): testFileStrings = glob.glob(os.path.join(HOME_PATH, "test", 'test_*.py')) print(testFileStrings) suite = unittest.TestSuite() for t in testFileStrings: v = "test."+t[len(HOME_PATH)+6:-3] #v = v.replace("\/", '.') #v = v.replace("\\", '.') cmodul = importlib.import_module(v) class_ = getattr(cmodul, "MyTestCase") suite.addTest(class_()) #module_strings = [str for str in test_file_strings] #mod = __import__(os.path.join(HOME_PATH, "test", 'test_css.py'), globals(), locals(), ['suite']) #suitefn = getattr(mod, 'MyTestCase') #suite.addTest(suitefn()) # suites = ["test.test_css.MyTestCase()"] # testSuite = unittest.TestSuite(suites) return suite if __name__ == '__main__': # loader = MyTestLoader() print ("start") loader = unittest.TestLoader() suite = create_test_suite() #loader.discover(os.path.join(HOME_PATH, "test"), 'test_.*py') runner = unittest.TextTestRunner(verbosity=2) runner.run(suite)