• 算不上缺点吧,适合自己的才是最好的。Postman 毕竟是一个工具,对于编码不是很熟悉的同学来说上手容易,不过相对于编写代码
    不足之处以下几点:

    • 操作比较繁琐,你需要在界面上点来点去,写代码做接口测试就没那么麻烦,几行代码就搞定。
    • 部分功能受限,比如 Postman 里面一些变量的处理还是需要编写脚本 (还只能用 Js,如果不熟悉 js 就玩不转了) 所以综上所述,个人建议如果你是小白,写接口测试代码不熟悉那就先用 Postman 等工具,如果你对代码熟悉,就用代码来做接口测试。具体还看你们领导的要求。
    • 相关参考:Python 接口自动化测试实践
  • Postman+Newman+Jenkins 就可以做接口自动化,详见:Postman 接口自动化测试

  • 在 build.xml 补充下面两段代码

    <delete file="${testpath}/${test}.html"/>
    <delete file="${testpath}/${test}.jtl"/>
    

    补充后,run 部分的配置如下:

    <target name="run">
           <echo>funcMode = ${funcMode}</echo>
    
          <!-- 运行前删除旧的html和jtl-->
           <delete file="${testpath}/${test}.html"/>
           <delete file="${testpath}/${test}.jtl"/>
    
           <jmeter
               jmeterhome="${jmeter.home}"
               testplan ="${testpath}/${test}.jmx"
               resultlog="${testpath}/${test}.jtl">
           <!--
               <jvmarg value="-Xincgc"/>
               <jvmarg value="-Xmx128m"/>
               <jvmarg value="-Dproperty=value"/>
               <jmeterarg value="-qextra.properties"/>
           -->
               <!-- Force suitable defaults -->
               <property name="jmeter.save.saveservice.output_format" value="xml"/>
               <property name="jmeter.save.saveservice.assertion_results" value="all"/>
               <property name="jmeter.save.saveservice.bytes" value="true"/>
               <property name="file_format.testlog" value="${format}"/>
               <property name="jmeter.save.saveservice.response_data.on_error" value="${funcMode}"/>
           </jmeter>
       </target>
    

    参考资料: Jmeter+Ant+Jenkins 接口自动化测试平台综合实践

  • 赞! 一个人就是一个团队啊!

  • 是的。😄

  • 你这个是不是没有安装好啊?你卸载干净重新安装试试。

  • 哦,懂了,原来如此。

  • 安装 rabbitmq 前需要先安装erlang,你是否安装了呢?另外可以参考这个文章:Win10 环境 HttpRunnerManager 实践

  • 你说的是那个下拉菜单吧,我这边运行多次测试后,也生成了多个测试报告,打开最后一个生成的测试报告,但是下拉菜单只有最后一次运行的结果,没有之前运行的结果记录。

  • 不过还有一个问题,最近 10 次运行的结果只显示当前打开报告运行的结果,不会显示之前运行的结果。这个是怎么回事?

  • 好的,在本地文件夹中使用浏览器单独打开可以了。我在 pycharm 里面打开预览加载本地服务,导致使用 url 预览无法查看。

  • 我没有部署到平台啊,直接在本地用浏览器打开生成的 html 测试报告,打开之后就是没有历史数据。你下载我给你提供的那个生成在本地的 html 测试报告看看:https://pan.baidu.com/s/1Eoj_UT03-TUemmsq6F5q_w 也是一样的。

  • 报告原始文件下载地址:https://pan.baidu.com/s/1Eoj_UT03-TUemmsq6F5q_w

  • 你好,问一下我这边为何不能显示最近十次的运行结果,如下图所示:

    运行环境

    • Python 3.5
    • Appium 1.7.2
    • Win10 64bit

    相关代码

    run.py

    import unittest
    # from  BSTestRunner import BSTestRunner
    from HTMLTestRunner_Chart import HTMLTestRunner
    import time,logging
    
    
    test_dir='../test_case'
    report_dir='../reports'
    
    discover=unittest.defaultTestLoader.discover(test_dir,pattern='test_login.py')
    
    now=time.strftime('%Y-%m-%d %H_%M_%S')
    report_name=report_dir+'/'+now+' test_report.html'
    
    with open(report_name,'wb') as f:
        runner=HTMLTestRunner(stream=f,title='Kyb Test Report',
                              description='kyb Android app test report',
                              retry=1,verbosity=2,save_last_try=True)
    
        logging.info('start run test case...')
        runner.run(discover)
    

    test_login.py

    from common.myunit import StartEnd
    from businessView.loginView import LoginView
    import unittest
    import logging
    
    class TestLogin(StartEnd):
        csv_file='../data/account.csv'
    
        # @unittest.skip('test_login_zxw2018')
        def test_login_zxw2018(self):
            logging.info('======test_login_zxw2018=====')
            l=LoginView(self.driver)
            data=l.get_csv_data(self.csv_file,2)
    
            l.login_action(data[0],data[1])
            self.assertTrue(l.check_loginStatus())
    
        # @unittest.skip('skip test_login_zxw2017')
        def test_login_zxw2017(self):
            logging.info('======test_login_zxw2017=====')
            l=LoginView(self.driver)
            data = l.get_csv_data(self.csv_file, 1)
    
            l.login_action(data[0], data[1])
            self.assertTrue(l.check_loginStatus())
    
        # @unittest.skip('test_login_error')
        def test_login_error(self):
            logging.info('======test_login_error=====')
            l = LoginView(self.driver)
            data = l.get_csv_data(self.csv_file, 3)
    
            l.login_action(data[0], data[1])
            self.assertFalse(l.check_loginStatus(),msg='login fail!')
    
    if __name__ == '__main__':
        unittest.main()
    

    myunit.py

    Tips:由于自己单独封装了截图的方法,所以这里依旧把 driver 初始化放在 setUp 方法。

    import unittest
    from common.desired_caps import appium_desired
    import logging
    from time import sleep
    
    class StartEnd(unittest.TestCase):
        def setUp(self):
            logging.info('=====setUp====')
            self.driver=appium_desired()
    
        def tearDown(self):
            logging.info('====tearDown====')
            sleep(5)
            self.driver.close_app()
    
  • 解决方案,分别手动安装 appium 的依赖程序。那两个 app 的参考地址分别为:

    settings_apk-debug.apk

    C\:\\Users\\Administrator\\AppData\\Roaming\\npm\\node_modules\\appium\\node_modules\\_io.appium.settings\@user1\@user2\\app\\build\\outputs\\apk\\settings_apk-debug.apk 
    

    UnicodeIME-debug.apk

    
    C\:\\Users\\Administrator\\AppData\\Roaming\\npm\\node_modules\\appium\\node_modules\\_appium-android-ime\@user3\@user4\\bin\\UnicodeIME-debug.apk
    
  • usb_install_thread()点击弹窗的方法实现内容是什么呢?
    另外有些设备的 ROM 安装io.appium.settingsio.appium.settings.Settings两个守护进程都强制必须用户手动确认才能安装。😅

  • 期待期待!

  • unittest 有这个失败重试机制吗?

  • chromediver 路径 一般位于 appium 路径中的...\node_modules\appium-chromedriver\chromedriver\win 里面

  • 我也读了虫师那本《Web 接口开发与自动化测试——基于 Python 语言》其中的 Django 不是接口测试的必需品,书里只是以 Django 来讲解接口开发实现,让读者更加深入理解接口测试。当然也可以使用 django 开发接口测试平台,社区里的开源项目HttpRunnerManager就是用 Django 做后台。当然,Django 还可以做 j 接口 Mock 服务。
    如果单纯站在接口测试的角度,最基础的需要掌握 Python 的Requests库的使用,unittest单元测试框架, HTTP协议原理,Jenkins等。

  • 可以无线远程连接吗?这个有点类似total control 远程工具吧。

  • 你为什么会加班? at August 16, 2018

    曾经在某公司里面有考勤排行榜。。排名靠后会被 HR 谈话。

  • 也希望使用过 httpRunner 的小伙伴一起讨论交流一下。

  • 谢谢提醒,我这边尝试了一下,也是 ok 的!

  • 你这个学习方向搞错了,应该是你先要确定用 Python 来做什么?自动化测试?接口测试?爬虫?你要学自动化测试就去安装 selenium,appium 等框架,你要学接口测试,爬虫就去安装 requests....而不是说一上来就先安装工具。
    就好像你买了一台新电脑,你不能因为里面应用少就打开应用市场把所有软件就下载下来安装吧,而是先确定你需要什么软件,再去下载。