Skip to main content

unittest enhancement

Project description

unitplus

Languate - Python PyPI - License PyPI PyPI - Downloads

Enhancement for unittest by adding status, priority, tags, owner properties for testcases and filters.

Install

pip install unitplus

Simple Use

Write TestCase

import unitplus


class TestDemo(unitplus.TestCase):
    priority = 'p1'
    status = 'ready'
    owner = 'superhin'
    iteration = 'v0.1.0'
    tags = ['demo']

    @unitplus.test(title='test demo a', priority='p2')
    def test_a(self):
        self.logger.info('a demo test case')

    @unitplus.test(title='test ddt with data',data=['a', 'b', 'c'])
    def test_b(self, item):
        self.logger.info('item =', item)

if __name__ == '__main__':
    unitplus.main()

Use TesPlan to run tests

import unitplus


class TestPlanDemo(unitplus.TestPlan):
    # test names for suite
    tests = [
        'cases.testdemo',
    ]

    # filter tests by attributes
    filter = {
        'priorities': ['p0', 'p1'],
        'status': ['ready'],
        'tags': ['demo'],  # include tags
        'exclude_tags': ['post'],
        'exclude_names': [
            'cases.test_case3.TestA.test_get03',
            'cases.test_case4.TestA.test_get02',
        ]

    }


if __name__ == '__main__':
    # run suite , supporting multiple threads
    TestPlanDemo().run(verbosity=3)

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

unitplus-0.1.1.tar.gz (16.4 kB view details)

Uploaded Source

File details

Details for the file unitplus-0.1.1.tar.gz.

File metadata

  • Download URL: unitplus-0.1.1.tar.gz
  • Upload date:
  • Size: 16.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.6

File hashes

Hashes for unitplus-0.1.1.tar.gz
Algorithm Hash digest
SHA256 46bfe8430cc2ba3bd6168ac03a1196d4b035ecd38e717af1b4dbf35955e8b35d
MD5 d5c5a1c285c16a9ffe9f5affd9e5f1f4
BLAKE2b-256 c62e407d9b1a3164a5abe07f30c794f18f01b4454cab1a44126b012f7dc4ff22

See more details on using hashes here.

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