Python鼻子注释

Python鼻子注释,python,nose,Python,Nose,我想用注释标记每个单独的测试用例@SmokeTest或@LoadTest@RegressionTest或@LongRunningTest 是否可以使用提供注释的Python nose将每个测试用例分类为以下类别之一 烟雾试验 负荷试验 回归 长时间运行试验 我想为每个单独的测试用例添加标签,请提供您的建议。 很难准确地说出你在问什么,但听起来你可能在寻找哪些可以为测试设置属性(并根据属性选择测试组)。很难准确地说出你在问什么,但听起来你可能在寻找哪些可以为测试设置属性(并根据属性选择测试组)。

我想用注释标记每个单独的测试用例
@SmokeTest
@LoadTest
@RegressionTest
@LongRunningTest

是否可以使用提供注释的Python nose将每个测试用例分类为以下类别之一

  • 烟雾试验
  • 负荷试验
  • 回归
  • 长时间运行试验 我想为每个单独的测试用例添加标签,请提供您的建议。

  • 很难准确地说出你在问什么,但听起来你可能在寻找哪些可以为测试设置属性(并根据属性选择测试组)。

    很难准确地说出你在问什么,但听起来你可能在寻找哪些可以为测试设置属性(并根据属性选择测试组)。

    很难准确地说出您的要求,但听起来您可能正在寻找哪一个允许您为测试设置属性(并根据属性选择测试组).

    很难准确地说出你在问什么,但听起来你可能在寻找哪一个可以让你为测试设置属性(并根据属性选择测试组)。

    使用
    @attr
    添加属性
    @attr
    可以为类设置属性,如果你想运行整个类,也可以使用下面相同的方法

    参考:

    然后将其作为

    nosetests -a 'smoke'            #Runs test_awesome_1 only
    nosetests -a 'load'             #Runs test_awesome_2 only
    nosetests -a 'regression'       #Runs test_awesome_3 and test_awesome_4
    

    使用
    @attr
    添加属性
    @attr
    可以为类设置属性,如果要运行整个类,也可以使用下面相同的方法设置属性

    参考:

    然后将其作为

    nosetests -a 'smoke'            #Runs test_awesome_1 only
    nosetests -a 'load'             #Runs test_awesome_2 only
    nosetests -a 'regression'       #Runs test_awesome_3 and test_awesome_4
    

    使用
    @attr
    添加属性
    @attr
    可以为类设置属性,如果要运行整个类,也可以使用下面相同的方法设置属性

    参考:

    然后将其作为

    nosetests -a 'smoke'            #Runs test_awesome_1 only
    nosetests -a 'load'             #Runs test_awesome_2 only
    nosetests -a 'regression'       #Runs test_awesome_3 and test_awesome_4
    

    使用
    @attr
    添加属性
    @attr
    可以为类设置属性,如果要运行整个类,也可以使用下面相同的方法设置属性

    参考:

    然后将其作为

    nosetests -a 'smoke'            #Runs test_awesome_1 only
    nosetests -a 'load'             #Runs test_awesome_2 only
    nosetests -a 'regression'       #Runs test_awesome_3 and test_awesome_4
    

    使用
    @attr
    添加属性以标记测试用例和类,并添加注释:

    from nose.plugins.attrib import attr
    
        @attr(priority='first')
        def test_support_1():
            #test details...
    
        @attr(priority='second')
        def test_support_2():
            #test details...
    
    按以下方式运行:

    nosetests -a priority=first
    nosetests -a priority=second
    
    nosetests -a priority=sanity
    
    在Python 2.6及更高版本中,可以对类设置
    @attr
    ,如下所示:

        @attr(priority='sanity')
        class MyTestCase:
           def test_support_1(self):
             pass
           def test_support_2(self):
             pass
    
    按以下方式运行:

    nosetests -a priority=first
    nosetests -a priority=second
    
    nosetests -a priority=sanity
    

    使用
    @attr
    添加属性以标记测试用例和类,并添加注释:

    from nose.plugins.attrib import attr
    
        @attr(priority='first')
        def test_support_1():
            #test details...
    
        @attr(priority='second')
        def test_support_2():
            #test details...
    
    按以下方式运行:

    nosetests -a priority=first
    nosetests -a priority=second
    
    nosetests -a priority=sanity
    
    在Python 2.6及更高版本中,可以对类设置
    @attr
    ,如下所示:

        @attr(priority='sanity')
        class MyTestCase:
           def test_support_1(self):
             pass
           def test_support_2(self):
             pass
    
    按以下方式运行:

    nosetests -a priority=first
    nosetests -a priority=second
    
    nosetests -a priority=sanity
    

    使用
    @attr
    添加属性以标记测试用例和类,并添加注释:

    from nose.plugins.attrib import attr
    
        @attr(priority='first')
        def test_support_1():
            #test details...
    
        @attr(priority='second')
        def test_support_2():
            #test details...
    
    按以下方式运行:

    nosetests -a priority=first
    nosetests -a priority=second
    
    nosetests -a priority=sanity
    
    在Python 2.6及更高版本中,可以对类设置
    @attr
    ,如下所示:

        @attr(priority='sanity')
        class MyTestCase:
           def test_support_1(self):
             pass
           def test_support_2(self):
             pass
    
    按以下方式运行:

    nosetests -a priority=first
    nosetests -a priority=second
    
    nosetests -a priority=sanity
    

    使用
    @attr
    添加属性以标记测试用例和类,并添加注释:

    from nose.plugins.attrib import attr
    
        @attr(priority='first')
        def test_support_1():
            #test details...
    
        @attr(priority='second')
        def test_support_2():
            #test details...
    
    按以下方式运行:

    nosetests -a priority=first
    nosetests -a priority=second
    
    nosetests -a priority=sanity
    
    在Python 2.6及更高版本中,可以对类设置
    @attr
    ,如下所示:

        @attr(priority='sanity')
        class MyTestCase:
           def test_support_1(self):
             pass
           def test_support_2(self):
             pass
    
    按以下方式运行:

    nosetests -a priority=first
    nosetests -a priority=second
    
    nosetests -a priority=sanity