断言
断言内容是自动化脚本的重要内容,正确设置断言以后才能帮助我们判断测试用例执行结果。
断言方法
- assertEqual(a, b) 判断a==b
- assertNotEqual(a, b) 判断a!=b
- assertTrue(x) bool(x) is True
- assertFalse(x) bool(x) is False
- assertIs(a, b) a is b
- assertIsNot(a, b) a is not b
- assertIsNone(x) x is None
- assertIsNotNone(x) x is not None
- assertIn(a, b) a in b
- assertNotIn(a, b) a not in b
- assertIsInstance(a, b) isinstance(a, b)
- assertNotIsInstance(a, b) not isinstance(a, b)