Brief talk for django test
来源:互联网 发布:家庭媒体中心软件 编辑:程序博客网 时间:2024/06/05 09:43
Core tasks
(1)writing tests
(2)running tests
Writing
(a)TestCase class
django.test.TestCase as subclass from unittest.TestCase
(b) Mock
situation: patch out external function call in view
notes: where to patch is where it is used or it is looked up. that is, that
function to be mocked
(b.1)patch as decorator or context manager
makes it easy to mock classes or objects in a module under test.
Running
(a)coverage
Code coverage describes how much source code has been tested.
(a.1)installation by pip (c extension required in linux)
pip install coverage
(a.2)common commands
coverage run --source=SRC1,SRC2,... manage.py test test_label #
coverage report -m
for example, assume that working dir is just under django project or same level with app to be test,
coverage run --source=./some_app manage.py test ./some_app/
, where source option is used for limiting report statistic range
- Brief talk for django test
- Linux kernel test brief introuction
- Talk: Google for developers
- Setup E-mail test environment for Pinax(django)
- for test test test
- Privacy Policy for Baby Talk
- BRIEF
- BRIEF
- For test
- for test
- for test~~~
- for test
- for test
- For Test
- For Test
- for test
- for test
- for test
- 微服务时代下崛起的 TestOps 工程师
- Python采集实例2
- OkHttpClient get请求
- 第一届&第二届“幻想杯”NOIP模拟赛 标程
- http传输字符编码与转义(深度好文)
- Brief talk for django test
- 读老罗的安卓之旅这本书的一些笔记及个人的理解
- 全自动脚本安装虚拟机
- NOIP复赛复习(四)读写外挂与高精度模板
- 跟我学习dubbo-ZooKeeper注册中心安装(2)
- 电子商务网站测试经验总结
- 欢迎使用CSDN-markdown编辑器
- IntelliJ IDEA 常用设置讲解
- 获取客户端http请求IP地址工具类