unittest some of the assertions Summary

本人做测试工作,使用python编写自动化脚本,刚开始写博客,写一篇看看

unit test框架是基础框架,收集汇总了一些断言的写法如下:

assert * (): number of assertions: during execution of the test case, if the embodiment is performed by the final use, equality is determined by determining the actual and the expected test results obtained.

assertEqual (a, b, [msg = 'print the test failure information']): assert a and b are equal, are equal by test cases.

assertNotEqual (a, b, [msg = 'print the test failure information']): assert a and b are equal, not equal, then through the test.

assertTrue (x, [msg = 'test fails printed information']): True if x is asserted, then the test is True through.

assertFalse (x, [msg = 'test fails printed information']): assert x is False, False if the test is passed.

assertIs (a, b, [msg = 'test fails printed information']): assert whether a b, then the test is passed.

assertNotIs (a, b, [msg = 'test fails printed information']): assert whether a b, then the test is not passed.

assertIsNone (x, [msg = 'test fails printed information']): x is asserted None, None of the test is passed.

assertIsNotNone (x, [msg = 'test fails printed information']): x is asserted None, None of the test is not passed.

assertIn (a, b, [msg = 'test fails printed information']): b is in the asserted a, b, in the test passed.

assertNotIn (a, b, [msg = 'test fails printed information']): b is in the asserted a, b, the test is not passed.

assertIsInstance (a, b, [msg = 'print the test failure information']): assert a is b is an example, and the test is passed.

assertNotIsInstance (a, b, [msg = 'print the test failure information']): assert a is b is an example, and not by the test.

发布了1 篇原创文章 · 获赞 2 · 访问量 43

Guess you like

Origin blog.csdn.net/dx1254077634/article/details/104356876