class Users(unittest.TestCase): def setUp(self): #get api's case self.api = SmsAPI("users") self.caselist = self.api.getCaseList() def tearDown(self): pass def test_case1(self): act_rs = self.caselist[0]["act_rs"] exp_rs = eval(self.caselist[0]["exp_rs"]) self.assertTrue(self.api.comparedRS(act_rs, exp_rs), act_rs) def test_case2(self): act_rs = self.caselist[1]["act_rs"] exp_rs = eval(self.caselist[1]["exp_rs"]) self.assertTrue(self.api.comparedRS(act_rs, exp_rs), act_rs) def test_case3(self): act_rs = self.caselist[2]["act_rs"] exp_rs = eval(self.caselist[2]["exp_rs"]) self.assertTrue(self.api.comparedRS(act_rs, exp_rs), act_rs) def test_case4(self): act_rs = self.caselist[3]["act_rs"] exp_rs = eval(self.caselist[3]["exp_rs"]) self.assertTrue(self.api.comparedRS(act_rs, exp_rs), act_rs)
class TestMathUnitTest(unittest.TestCase): @parameterized.expand([ #(caselist[0]["name"],caselist[0]["exp_rs"],caselist[0]["exp_rs"]), ("22", "act_rs", "exp_rs"), ]) def test_floor(self, name, input, expected): assert_equal(input, expected) def setUp(self): #get api's case self.api = SmsAPI("handshake") self.caselist = self.api.getCaseList() def test_handshake(self): pass
class Condition(unittest.TestCase): def setUp(self): self.api = SmsAPI("condition") self.caselist = self.api.getCaseList() def tearDown(self): pass def test_case1(self): act_rs = self.caselist[0]["act_rs"] exp_rs = eval(self.caselist[0]["exp_rs"]) self.assertTrue(self.api.comparedRS(act_rs, exp_rs), act_rs) def test_case2(self): act_rs = self.caselist[1]["act_rs"] exp_rs = eval(self.caselist[1]["exp_rs"]) self.assertTrue(self.api.comparedRS(act_rs, exp_rs), act_rs)