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. learning makefile vpath(1)

  2. day062 中间件

    中间件:  作用: 介于request和response之间的一到处理过程,相对比较轻量级,并且在全局上改变django的输入与输出,因为改变的是全局,所以需要谨慎使用,用不好会影响到性能. 当用户发 ...

  3. shell读取mysql数据库

    select_sql="select value from glpi_configs where name='version' " db_data=`mysql -h $host ...

  4. Julia安装以及使用扩展包package(ERROR: UndefVarError: Pkg not defined)

    刚刚安装好Julia1.0,想进行第一步尝试: Pkg.add("PyPlot") 却出现错误:ERROR: UndefVarError: Pkg not defined 问题描述 ...

  5. 第一章01:熟悉java,发展历史

    1. java由来: 原公司,sun,后来被oracle\甲骨文公司收购 java,主要用于开发互联网软件,例如:QQ.迅雷.淘宝.京东

  6. 分布式系统定时任务,保证只有一个服务执行了改任务--采用redis分布式锁来实现(文章摘自:https://www.cnblogs.com/0201zcr/p/5942748.html)

    文章摘自:https://www.cnblogs.com/0201zcr/p/5942748.html package com.abtc.server.mine.common.utils; impor ...

  7. Ajax实战(原生)

    /** 之前一直在学习ajax,也拿jQuery写了很多,感觉还是写原生的对基础的理论理解的深刻.特此书写. * 得到ajax对象 */ function getajaxHttp() { var xm ...

  8. angular2在ts中使用transform转换时间格式

    摘要:在angular1中我们可以在控制器中像下面那样使用filter: $filter('date')(myDate, 'yyyy-MM-dd'); 但是如何在angular2中在ts中使用自定义p ...

  9. poj1873(枚举+凸包)

    The Fortified Forest Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 7291   Accepted: 2 ...

  10. 前端-URL到页面显示的全过程

    大概有以下几步: DNS解析(浏览器缓存→系统缓存→路由器缓存→ISP DNS缓存→从根域名服务器递归搜索) 建立TCP链接(TCP的三次握手) 浏览器向服务器发送HTTP请求 服务器返回结果给浏览器 ...