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. HTTP安全通信:Https和SSL

    1. HTTPS概念 1)简介 HTTPS(全称:Hypertext Transfer Protocol over Secure Socket Layer),是以安全为目标的HTTP通道,简单讲是HT ...

  2. 『Python』多进程处理

    尝试学习python的多进程模组,对比多线程,大概的区别在: 1.多进程的处理速度更快 2.多进程的各个子进程之间交换数据很不方便 多进程调用方式 进程基本使用multicore() 进程池优化进程的 ...

  3. 关于var time = +new Date;

    文章地址:https://www.cnblogs.com/Raoh/p/4212075.html

  4. linux搭建node环境

    这篇完全够了! 地址:https://www.cnblogs.com/lovefc/p/8847343.html 附上一张图:

  5. CRM的组织架构

    PPOMA_CRM... 和ERP的组织架构一样的. 这边在功能参数里匹配ECC的组织.ECC的组织架构则会设置控制范围,成本中心啊,业务范围,公司,人事范围等. 下面说说常见函数RH_STRUC_G ...

  6. select option 选中 取消js

    今天在写select option标签的过程中遇到一个问题,就是刷新页面自己选中的标签回显选择的值,清空表单,下拉选择默认的值: 1.这是默认的下拉框: 2.自己定义的下拉选项,红色方框中主要处理第一 ...

  7. 2015-10-05 js3

    Javascript 实例2九九乘法表 var s = ""; s += "<table>"; for (var i = 1; i < 10; ...

  8. 201621123075 week06-接口、内部类

    1.本周学习总结 1.1 面向对象学习暂告一段落,请使用思维导图,以封装.继承.多态为核心概念画一张思维导图或相关笔记,对面向对象思想进行一个总结. 注1:关键词与内容不求多,但概念之间的联系要清晰, ...

  9. Oracle获取当前年、月、日的方法

    Oracle获取当前年.月.日的方法 Oracle 获取当前年.月.日 1.//oracle中extract()函数从oracle 9i中引入,用于从一个date或者interval类型中截取到特定的 ...

  10. tensorFlow(一)相关重要函数理解

    1.函数及参数:tf.nn.conv2d conv2d( input, filter, strides, padding, use_cudnn_on_gpu=True, data_format='NH ...