unit testing - unittest python, missing function test -
i'm learning unittesting , i'm finding not of test functions being run. i've found first 4 run last 2 give no results. if comment out first 4 functions last 2 show up. how can of functions test?
i'm new unit-testing advice received
class mytest(unittest.testcase): def test_country(self): self.asserttrue(country in x) def test_company_size(self): self.asserttrue(company_size in x) def test_zipcode(self): self.asserttrue(zipcode in x) def test_region(self): self.asserttrue(region in x) def test_street(self): self.asserttrue(street in x) def test_address(self): self.asserttrue(address in x) if __name__ == '__main__': suite = unittest.testloader().loadtestsfromtestcase(mytest) unittest.texttestrunner(verbosity=3).run(suite)
results:
test_company_size (__main__.mytest) ... ok test_country (__main__.mytest) ... ok test_region (__main__.mytest) ... ok test_zipcode (__main__.mytest) ... ok ---------------------------------------------------------------------- ran 4 tests in 0.000s ok [finished in 1.5s]
Comments
Post a Comment