问题:

1、selenium导入unittest框架和HtmlReport框架后,HtmlReport不被执行。

2、IDE为Pycharm

假设代码为:

from selenium import webdriver

import unittest

class Test(unittest.TestCase):

  print "this is class Test"

  def setup(self):

    print "this is setup"

  def test_1(self):

    print "this is tesecase 1"

    #其他代码

  def tearDown(self):

    print "this is tearDown"

if __name__ == '__main__':

  print "this is __name__"

  #unittest.main()

网上搜索到的资料:

1、Pycharm运行导入unittest框架时,执行的的命令是“Run 'Unittests in XXX' ”,如下图所示:

2、此时执行顺序为:Class->def setup ->def test_1 ->def tearDown

3、如果执行的命令为“Run XXX”,那么会先执行class后,就执行“if __name__ == '__main__' ”

4、在代码“"if __name__ == '__main__' ”区域,右击“run xxx”即可,具体步骤参考第二个链接(有用的解决方案)

  4.1 首先删除Pycharm该文件的配置,“Edit Configurations”-"Python tests"下删除该文件的配置信息

参考资料:

http://www.ithao123.cn/content-6035445.html

有用的解决方案:http://stackoverflow.com/questions/20835466/pycharm-wont-allow-to-run-a-file-shows-run-unittest-option-only

最新文章

  1. 实践.Net Core在Linux环境下的第一个Hello World
  2. python爬虫感想
  3. 开源文档管理工具Joomla的网站安装
  4. Linux 命令速查
  5. python之self (转)
  6. LBP特征提取实现
  7. [Math]Divide Two Integers
  8. Redis数据备份和重启恢复
  9. 转载:WPF MVVM之INotifyPropertyChanged接口的几种实现方式
  10. CentOS7安装最新版git教程
  11. 3.QT中的debug相关的函数,以及文件锁的使用
  12. systemctl启动tomcat后,jps看不到进程
  13. 101210-450789-147200(可以激活Xshell5,而且可以升级) 亲测可用 只能用于xshell5
  14. css一些特殊选择器
  15. VC.时间_ZC测试代码
  16. 第15章 高并发服务器编程(2)_I/O多路复用
  17. os.popen与os.system区别
  18. KMP算法之next数组的求解思路
  19. How to Get Vertical Line from Point and Line
  20. C语言中递归什么时候能够省略return引发的思考:通过内联汇编解读C语言函数return的本质

热门文章

  1. Python的程序结构[2] -> 类/Class[5] -> 内建类 bytes 和 bytearray
  2. Spiral Matrix -- LeetCode
  3. 新博客:11101001.com
  4. UVA 11990 ”Dynamic“ Inversion(线段树+树状数组)
  5. ServicePointManager.ServerCertificateValidationCallback 冲突的解决
  6. 项目笔记:导出XML和导出全部XML功能
  7. log4j输出日志到flume
  8. oracle数据库中函数和存储过程中的区别
  9. java 中文转Unicode 以及 Unicode转中文
  10. 错误:“The requested resource () is not available.”的处置