用 myTestCase 来做 Python 的 UT

9
LOGO 用 myTestCase 用用 Python 用 UT 陈陈 [email protected]

description

用 myTestCase 来做 Python 的 UT. 陈钢 [email protected]. 自我介绍. 2003 年毕业于南京邮电的通信工程专业 2004 年开始认真学习 C 语言 2004 年在做机顶盒程序的时候发现接口层写得规范是很好的一件事。 2005-2008 年一直渴望学习 UML ,提高软件设计能力。 2008 年 9 月加入诺基亚西门子通信,开始学习敏捷,结对编程,测试驱动开发。 2011 年认真学习了 UML 。 现在,无 UT 不编程。. pyunit 简介. 被测函数. 测试用例组. 测试用例. 结果检查. 运行所有测试. - PowerPoint PPT Presentation

Transcript of 用 myTestCase 来做 Python 的 UT

Page 1: 用 myTestCase 来做 Python 的 UT

LOGO

用myTestCase来做 Python的 UT用myTestCase来做 Python的 UT

陈钢 [email protected]

Page 2: 用 myTestCase 来做 Python 的 UT

邮箱: [email protected]

自我介绍自我介绍

2003年毕业于南京邮电的通信工程专业2004年开始认真学习C 语言2004年在做机顶盒程序的时候发现接口层写得规范是很好的一件事。

2005-2008年一直渴望学习UML,提高软件设计能力。

2008 年 9 月加入诺基亚西门子通信,开始学习敏捷,结对编程,测试驱动开发。

2011年认真学习了UML。现在,无UT不编程。

Page 3: 用 myTestCase 来做 Python 的 UT

邮箱: [email protected]

pyunit简介pyunit简介

被测函数被测函数

测试用例组测试用例组

测试用例测试用例

结果检查结果检查

运行所有测试运行所有测试

Page 4: 用 myTestCase 来做 Python 的 UT

邮箱: [email protected]

myTestCase功能一:打印检查myTestCase功能一:打印检查

Page 5: 用 myTestCase 来做 Python 的 UT

邮箱: [email protected]

myTestCase功能二: stub设置myTestCase功能二: stub设置

Page 6: 用 myTestCase 来做 Python 的 UT

邮箱: [email protected]

myTestCase功能三:mock设置myTestCase功能三:mock设置

Page 7: 用 myTestCase 来做 Python 的 UT

邮箱: [email protected]

为什么要基于 pyunit为什么要基于 pyunit

pyunit是随 python官方发布的,有前途UT的核心功能 pyunit都不错

丰富的结果检查语句 Case的组织: case列表, case的 suite Case的发现和执行,选择性执行 Case运行结果报告

myTestCase只需要做点个性化需求的工作而已

Page 8: 用 myTestCase 来做 Python 的 UT

邮箱: [email protected]

myTestCase安装myTestCase安装

源码地址: https://code.google.com/p/py-mtc/

python setup.py install注意:

只在 python2.7.3上验证过 myTestCase通过替换变量空间内’ key’对应的

‘ Value’来达到 stub的目的,如果你的被测函数与测试用例用不同的变量空间访问同一个对象, stub将不起作用。

Page 9: 用 myTestCase 来做 Python 的 UT

谢谢!谢谢!

邮箱: [email protected]