I have a general test class in my nosetests suit and some sub-classes, inheriting from it.

The config is likewise:

class CGeneral_Test(object)::
"""This class defines the general testcase"""
def __init__ (self):
do_some_init()
print "initialisation of general class done!" def setUp(self):
print "this is the general setup method"
do_setup() def tearDown(self):
print "this is the general teardown method"
do_teardown()

Now, I have the subclasses which looks like this:

class CIPv6_Test(CGeneral_Test):
"""This class defines the sub, inherited testcase"""
def __init__ (self):
super(CIPv6_Test, self).__init__()
do_some_sub_init()
print "initialisation of sub class done!" def setUp(self):
print "this is the per-test sub setup method"
do_sub_setup() def test_routing_64(self):
do_actual_testing_scenarios() def tearDown(self):
print "this is the per-test sub teardown method"
do_sub_teardown()

So, what I want to achieve would be that each test would invoke both the sub-class and the super class setUp methods. Hence, the desired order of test is:

Base Setup
Inherited Setup
This is a some test.
Inherited Teardown
Base Teardown

Inheritance setUp() and tearDown() methods from Classsetup() and Classteardown的更多相关文章

  1. Junit测试中的setup和teardown 和 @before 和 @After 方法

    这几天做Junit测试接触到了setup和teardown两个方法,简单的可以这样理解它们,setup主要实现测试前的初始化工作,而teardown则主要实现测试完成后的垃圾回收等工作. 需要注意的是 ...

  2. setUp()和tearDown()函数

    1.什么是setUp()和tearDown()函数? 2.为什么我们要用setUp()和tearDown()函数? 3.我们该怎样用setUp()和tearDown()? 1.什么是setUp()和t ...

  3. pytest自动化2:测试用例setup和teardown

    前言: pytest支持函数和类两种用例方式,针对每种情况都有不同的代码 pytest用例运行级别 模块级(setup_module/teardown_module)开始于模块始末,全局的 函数级(s ...

  4. pytest 2.测试用例setup和teardown

    之前我写的unittest的setup和teardown,还有setupClass和teardownClass(需要配合@classmethod装饰器一起使用),接下来就介绍pytest的类似于这类的 ...

  5. 让一个继承unittest.TestCase的类下的setUp和tearDown只执行一次

    知道unittest单元测试框架的朋友应该都知道, 执行继承了unittest.TestCase的类下每个test开头的方法(就是用例)时,都会执行setUp和tearDown,如下面的例子所示: i ...

  6. unittest:2 执行多条用例,仅执行一次setUp和tearDown

    对象方法setUp()和tearDown() 每个用例执行前后都会被调用.但是有另外一种场景:setUp之后执行完所有用例,最后调用一次tearDown.比如打开网页,多条用例分别验证网页上的元素正确 ...

  7. pytest文档4-测试用例setup和teardown

    前言 学过unittest的都知道里面用前置和后置setup和teardown非常好用,在每次用例开始前和结束后都去执行一次. 当然还有更高级一点的setupClass和teardownClass,需 ...

  8. nose的setup和teardown

    参考:http://blog.csdn.net/linda1000/article/details/8533349 1.模块的setUp和tearDown def setUp(): print &qu ...

  9. python单元测试框架pytest——fixture函数(类似unitest的setup和teardown)

    pytest的setup和teardown函数(曾被一家云计算面试官问到过). pytest提供了fixture函数用以在测试执行前和执行后进行必要的准备和清理工作.与python自带的unitest ...

随机推荐

  1. Javascript原型,原型链?有什么特点?

    如何: js中继承都是通过原型对象实现的 什么是原型对象: 集中存储同一类型的所有子对象,共用成员的父对象 何时: 只要继承,必然原型对象 如何: 创建: 不用创建,买一赠一 每创建一个构造函数,都附 ...

  2. string部分方法

    1.string.lastIndexOf() lastIndexOf 是从string末尾查找,但是返回值仍是首部的位置值. 2.string.replace() 放一个正则匹配会全部替换. 3.st ...

  3. mac 不小心把管理员改成了普通用户

    最近手贱,不小心把mbp仅有的管理员账号设置成了普通用户,想重新改回管理员,竟然需要用其他管理员账号去更改.简直 那个 啥 ~ 下面将提供创建一个新的管理员账号的方案 不仅适用于上述我出现的问题,也适 ...

  4. 网络编程—网络基础概览、socket,TCP/UDP协议

    网络基础概览 socket概览 socket模块—TCP/UDP的实现 TCP/UDP总结 网络基础概览 osi七层协议各层主要的协议 # 物理层传输电信号1010101010 # 数据链路层,以太网 ...

  5. 调用shutdown.sh后出现could not contact localhost8005 tomcat may not be running报错问题

    之前调用tomcat的shutdown.sh无法关闭tomcat,一直报could not contact localhost8005 tomcat may not be running错. 在网上找 ...

  6. VSTO:使用C#开发Excel、Word【16】

    使用工作表对象Worksheet对象表示Excel工作簿中的工作表.Worksheet有一个Name属性,返回工作表的名称(例如“Sheet1”). 工作表管理Worksheet对象具有一个Index ...

  7. Wampserver 403问题

    使用Wampserver   2.4.23做反向代理时报403没有权限:是因为在升级到2.4之后的版本只修改httpd.conf文件不管用 正确步骤如下:1.修改httpd.conf 文件中的Requ ...

  8. Codeforces Round #324 (Div. 2) (哥德巴赫猜想)

    题目:http://codeforces.com/problemset/problem/584/D 思路: 关于偶数的哥德巴赫猜想:任一大于2的偶数都可写成两个素数之和. 关于奇数的哥德巴赫猜想:任一 ...

  9. msfvenom生成各类Payload命令

    Often one of the most useful (and to the beginner underrated) abilities of Metasploit is the msfpayl ...

  10. 基于Verilog的按键检测实验

    一.模块框图及基本思路 detect_module:检测按键输入脚的电平边沿变化 delay_10ms_module:延时消抖,输出按键有效信号 debounce_module:前两个模块的组合模块 ...