python官方文档

https://docs.python.org/3/contents.html

For production environments it is recommended that tests be driven by a continuous integration system
such as Buildbot , Jenkins or Hudson .
Tools/unittestgui/unittestgui.py

例如:
import unittest

class TestStringMethods(unittest.TestCase):

def test_upper(self):
    self.assertEqual('foo'.upper(), 'FOO')

def test_isupper(self):
    self.assertTrue('FOO'.isupper())
    self.assertFalse('Foo'.isupper())

def test_split(self):
    s = 'hello world'
    self.assertEqual(s.split(), ['hello', 'world'])
    # check that s.split fails when the separator is not a string
    with self.assertRaises(TypeError):
        s.split(2)

if name == 'main':
unittest.main()

一个TestCase实例的测试代码应该是完全自包含的,这样它可以与任何数量的其他测试用例隔离或任意组合运行。

真正需要做的只是拼出关键的参数(url参数或者body参数)
可以借助装饰器去实现参数组装、日志打印等一系列功能

原文地址:https://www.cnblogs.com/ITniu/p/6836169.html