51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

查看: 2023|回复: 1
打印 上一主题 下一主题

[Appium] 网上关于appium使用HTMLTestRuner生成测试报告请教大神!

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2016-12-3 11:46:57 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
网上关于appium使用HTMLTestRuner生成测试报告,写的报告有一些简陋,大神们有更好的方案生成比较好一些的报告吗?
下面是我现在用的生成报告的脚本:

# -*- coding:UTF-8 -*-
from appium import webdriver
#from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from time import sleep
import unittest
import time
import HTMLTestRunner
import os
import importlib



class Dttest(unittest.TestCase):
      @classmethod
      def setUpClass(self):
          desired_caps={}
          desired_caps['platformName']='Android'
          desired_caps['platformVersion']='6.0.1'
          desired_caps['deviceName']='MI NOTE LTE'
          desired_caps['appPackage']='com.tuniu.app.ui'
          desired_caps['appActivity']='.homepage.LaunchActivity'
          self.driver=webdriver.Remote('http://localhost:4723/wd/hub',desired_caps)

          self.driver.implicitly_wait(10)

      def testclick1(self):

          self.driver.find_element_by_id('com.tuniu.app.ui:id/iv_style3_card_1').click()

          self.driver.find_element_by_id('com.tuniu.hotel:id/tv_query').click()

          self.driver.find_element_by_id('com.tuniu.hotel:id/iv_product_small_image').click()

      sleep(5)
if __name__ == '__main__':
    suite = unittest.TestSuite()
    suite.addTest(Dttest('testclick1'))

    timestr = time.strftime('%Y%m%d%H%M%S',time.localtime(time.time()))
    filename = 'D:\\report\\result_'+timestr+'.html'
    fp = open(filename,'wb')
    runner = HTMLTestRunner.HTMLTestRunner(
        stream=fp,
        title='result',
        description='report'
    )
    runner.run(suite)
    fp.close()

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

  • TA的每日心情
    擦汗
    2017-4-13 04:27
  • 签到天数: 21 天

    连续签到: 1 天

    [LV.4]测试营长

    2#
    发表于 2016-12-4 23:36:28 | 只看该作者
    mark一下,次后用得上
    回复 支持 反对

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-5-4 11:11 , Processed in 0.063820 second(s), 22 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

    快速回复 返回顶部 返回列表