Skip to main content

unittest 用例执行过滤, 可选择用例级别或用例标志进行过滤

Project description

testfilter

unittest 用例执行过滤, 可选择用例级别或用例标志进行过滤

如何使用它?

>>> pip install testfilter
from testfilter import tag, Tag, level, Level, Meta
...
import unittest
from testfilter import *

Level.set_run_level(Level.P2)
Tag.set_run_tag(Tag.TEST)


class Demo(unittest.TestCase, metaclass=Meta):
    @tag(Tag.UAT, Tag.PROD)
    def test_001(self):
        self.assertEqual(1, 1)

    @tag(Tag.TEST)
    @level(Level.P2)
    def test_002(self):
        self.assertEqual(1, 1)

    @level(Level.P1)
    def test_003(self):
        self.assertEqual(1, 1)

    @level(Level.P3)
    def test_004(self):
        self.assertEqual(1, 1)


if __name__ == '__main__':

    unittest.main()

image

用例Tag

Tag 英文 中文
DEV Development 开发
TEST Testing 测试
UAT User Acceptance Test 用户验收测试
SIM Simulation 高仿
PROD Production 正式/生产

用例级别

Level:

SMOKE/P1 P2 P3 P4

用例级别参考

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

testfilter-0.0.2.tar.gz (2.9 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page