zoukankan      html  css  js  c++  java
  • 调用公共方法样例

    import unittest
    from public_method.test_public_get import test_public_get
    from public_method.test_public_post import test_public_post

    # 在写测试类以及测试用例时要规定一个命名习惯,一般测试类可以以Test开头,也可以以Test结尾。测试用例一般是以test开头。

    import unittest #导入unittest包

    class ApiTest(unittest.TestCase): #创建测试类:从unittest.TestCase继承

    #url
    def setUp(self): #初始化测试环境
    self.url2="http://app.shixuncom.com"

    #2 查询评论列表
    def test_post_searchreviewer(self):
    print ("查询评论列表接口执行开始。。。。")
    path = "/info/reviewer/getReviewerListByInfomationId"
    params = dict(infomationId='5b8dfe8f1134535094cae376', pageNum=1,pageSize=2)

    test_public_post(self,self.url2,path,params)
    print("查询评论列表接口执行结束。。。。")

    #注:setUp和tearDown可以选择是否需要
    def teardown(self):
    pass

    #执行测试用例
    if __name__ =="__main__":
    unittest.main()
  • 相关阅读:
    C语言II博客作业01
    学期总结
    C语言|博客作业01
    C语言|博客作业02
    C语言|博客作业08
    C语言|博客作业07
    C语言|博客作业06
    C语言|博客作业05
    C语言|博客作业04
    c语言||博客作业04
  • 原文地址:https://www.cnblogs.com/lanyy/p/10420749.html
Copyright © 2011-2022 走看看