def test_getMethodsWithNonTestedCodeString(self): sample_file = os.path.join(HelperTools.getParentDir(__file__), "res", "TestSample.test") test_list = [4, 13, 14] result = CoverageData.getMethodsWithNonTestedCodeString( self, sample_file, test_list) self.assertEqual(result, "test1() test3()")
def test_notCoveredAsString(self): test_list = [1, 2, 3, 5, 6, 7, 9, 10, 11] result = CoverageData.notCoveredAsString(self, test_list) self.assertEqual(result, "1 2 3 5 6 7 9 10 11")
def test_getMethodsWithNonTestedCodeString(self): sample_file = os.path.join(HelperTools.getParentDir(__file__), "res", "TestSample.test") test_list = [4, 13, 14] result = CoverageData.getMethodsWithNonTestedCodeString(self, sample_file, test_list) self.assertEqual(result, "test1() test3()")
run_coverage = False suite = unittest.TestSuite() test_dir = getParentDir(__file__) for file in os.listdir(test_dir): if file.startswith("Test") and file.endswith(".py"): a = file.replace(".py", "") if file != "Test": suite.addTest(unittest.defaultTestLoader.loadTestsFromName(a)) if run_coverage: coverage = coverage.coverage() coverage.start() unittest.TextTestRunner(verbosity=2, stream=sys.stdout).run(suite) if run_coverage: coverage.stop() coverageData = CoverageData(coverage) print("--------------\n") for string in coverageData.getCoverageData(): print(string) print("\n--------------") def warning(warning): # print("WARNING: ", warning, file=sys.stderr) pass