ddt
ddt类似数据驱动配合unittest 使用
import ddt
import unittest
@ddt.ddt
class Ddtunitest(unittest.TestCase):
def setUp(self):
print('setup')
@ddt.data(['a','b'],['t1','t2'])
@ddt.unpack
def test_sth(self,a,b):
print(a)
print(b)
print('test body')
# @ddt.file_data("data.json")
# @ddt.unpack
# def test_zth(self,a):
# print(a)
def tearDown(self):
print('teardown')
if __name__ == '__main__':
unittest.main()