问题:一个百度首页搜索的一个python+unittest测试,代码执行成功,但是用HTMLTestRunner输出的测试报告里面得内容有问题,具体问题是:测试条数,成功数,失败数都为0

代码

# -*- coding: utf-8 -*-

from selenium import webdriver

import os

import time

import unittest

import re

import HTMLTestRunner

from selenium.webdriver.support.wait import WebDriverWait

from selenium.webdriver.support import expected_conditions

from selenium.webdriver.common.by import By

from selenium.webdriver.common.keys import Keys

from selenium.webdriver.support.ui import Select

from selenium.common.exceptions import NoSuchElementException

from selenium.common.exceptions import NoAlertPresentException

class LoginBaiDu(unittest.TestCase):

def setUp(self):

self.driver = webdriver.Chrome()

self.driver.implicitly_wait(30)

self.base_url = "http://www.baidu.com"

self.verificationErrors = []

self.accept_next_alert = True

print('Done-01')

def test_baidu(self):

self.driver.get(self.base_url)

self.driver.find_element_by_id("su").click()

print('Done-02')

time.sleep(2)

jsClear="$(\"input[id='kw']\").val(\"\")"

self.driver.execute_script(jsClear)

print('Done-03')

time.sleep(2)

jsVal="$(\"input[id='kw']\").val(\"selenium+python\")"

self.driver.execute_script(jsVal)

time.sleep(1)

self.driver.find_element_by_xpath("//input[@id='su']").click()

print('Done-04')

self.driver.close()

print('Done-05')

def tearDown(self):

self.driver.quit()

self.assertEqual([], self.verificationErrors)

print("test down...")

if __name__=="__main__":

test=unittest.TestSuite()

test.addTest(setUp)

test.addTest(test_baidu)

file_path="D:\\workspace\\PythonLearn\\src\\LoginBaiDu\\result.html"

file_result=open(file_path,'wb')

runner=HTMLTestRunner.HTMLTestRunner(stream=file_result,title=u"百度首页测试",description=u"用例执行情况")

runner.run(test)

file_result.close()

生成的报告截图:

python htmltestrunner报告_为什么python+htmltestrunner生成的测试报告有问题?相关推荐

  1. python项目分析报告_实战 | Python自动生成PPT分析报告

    原标题:实战 | Python自动生成PPT分析报告 在数据分析里面有一句话是说,80%的时间要用于数据清洗和整理,而我觉得理想的状态应该是把更多的把时间花在数据背后的洞察当中.去年11月在简书占了个 ...

  2. python pdf报告_利用python设计PDF报告,jinja2,whtmltopdf,matplotlib,pandas

    转自:https://foofish.net/python-crawler-html2pdf.html 工具准备 弄清楚了网站的基本结构后就可以开始准备爬虫所依赖的工具包了.requests.beau ...

  3. python 时间序列预测_使用Python进行动手时间序列预测

    python 时间序列预测 Time series analysis is the endeavor of extracting meaningful summary and statistical ...

  4. python 概率分布模型_使用python的概率模型进行公司估值

    python 概率分布模型 Note from Towards Data Science's editors: While we allow independent authors to publis ...

  5. python图书馆管理系统实验报告_基于Python的图书馆业务报表自动生成研究

    龙源期刊网 http://www.qikan.com.cn 基于 Python 的图书馆业务报表自动生成研 究 作者:辛海滨 来源:<电脑知识与技术> 2016 年第 27 期 摘要:针对 ...

  6. python输出古诗词_使用LSTM训练生成古诗模型,其中生成器可以指定生成风格进行输出...

    RNNPoet项目 相关文章 项目介绍 文字预处理脚本介绍 梯度处理函数介绍 1.文件简介 LSTM_model.py:LSTM网络模型,提供了end_points接口,被其他部分调用 poetry_ ...

  7. 怎样用python自动化办公_会python基础,如何学习自动化办公?

    Python 自动化,爽爽的解决 本课程完全让你摒弃重复率高,机械操作的劳动,解放双手,自动化办公,比如Excel表的各种计算,合并,比对,尤其是跨表,大量数据的,连Excel打开都费劲的,Pytho ...

  8. python appium自动化测试框架unittest_Appium基于Python unittest自动化测试 自动化测试框架 -- PO并生成html测试报告...

    基于python单元测试框架unittest完成appium自动化测试,生成基于html可视化测试报告 代码示例: #利用unittest并生成测试报告 class Appium_test(unitt ...

  9. python集群_使用Python集群文档

    python集群 Natural Language Processing has made huge advancements in the last years. Currently, variou ...

最新文章

  1. CRM User Status profile中Business Transaction字段的用途 1
  2. Linux学习笔记之一————什么是Linux及其应用领域
  3. 从Google Maglev说起,如何造一个牛逼的负载均衡?
  4. 监控h264视频不能正常解码怎么办
  5. Mongoose 预定义模式修饰符 Getters 与 Setters 自定义修饰符
  6. 【grafana】grafana 添加 MySQL 本地无法连接
  7. neo4j 节点与关系
  8. 比特币所有权及隐私问题 | 转账的加密流程
  9. tomcat 远程调试
  10. 有关文档流的一些注意事项
  11. Libvirt虚拟机网络配置
  12. 从Labview硬件平台看ZYNQ 的应用
  13. 高中数学建模优秀论文_高中数学建模优秀论文大纲格式 高中数学建模优秀论文大纲怎么写...
  14. 三角网格库Triangle的使用
  15. Ural1671 Anansi's Cobweb 并查集
  16. 谈谈如何发起一次会议
  17. linux飞鸽传书项目实训,Linux_信使(iptux):Linux下的飞鸽传书,不知你是否使用过“飞鸽传书 - phpStudy...
  18. 大一寒假培训(七)——队列与优先队列
  19. qml 不刷新 放大还原_耳放攻略2020版提升耳机音质,怎么买才不坑?手把手教你买...
  20. TCP通信—客户端与客户端的双向通信

热门文章

  1. Linux(服务器编程):25---epoll复用技术实现统一处理信号事件源
  2. 【安卓开发】AndroidStudio项目提交到github最详细步骤
  3. C#LeetCode刷题-回溯算法
  4. C#LeetCode刷题之#561-数组拆分 I(Array Partition I)
  5. 风变编程课 囚徒困境 答案_当您对所有这些有用的在线编程课程感到不知所措时,如何摆脱困境...
  6. 机器人坐标系建立_如何在30分钟内建立一个简单的搜索机器人
  7. 平滑滤波器模板尺寸与平滑效果的关系_用PPT基础功能,教你打造发布会效果,这骚操作谁顶得住啊?...
  8. simulink模块使用记录2-EnabledSubsystem/merge
  9. 用python制作一款录屏小工具
  10. multiprocessing(python 版)