网上关于appium使用HTMLTestRuner生成测试报告请教大神!
网上关于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()
mark一下,次后用得上
页:
[1]