Skip to main content

System test framework with serial and parallel execution.

Project description

buildstatus

Installation

pip install systest

Description

Execute a sequence of test cases in serial and/or parallel.

Test cases in a list are executed in serial and test cases in a tuple are executed in parallel, in separate Python threads.

This framework is created with integration/system test in mind. The framework is not intended as a replacement for unittest, but rather to be a complement to it.

Documentation: http://systest.readthedocs.org/en/latest

Example usage

See the test suite: https://github.com/eerimoq/systest/blob/master/tests/test_systest.py

For example, the sequence below starts with test case MyTestCase("1"). When MyTestCase("1") has been executed, MyTestCase("2") and the list of MyTestCase("3") and MyTestCase("4") are executed in parallel. When both MyTestCase("2") and the list of MyTestCase("3") and MyTestCase("4") has been executed, MyTestCase("5") is executed. Then the sequence ends.

import logging
import systest

LOGGER = logging.getLogger(__name__)

# Define a testcase.
class MyTestCase(systest.TestCase):
    """Test case description.

    """

    def __init__(self, name):
        super(MyTestCase, self).__init__()
        self.name = "my_testcase_" + name

    def run(self):
        LOGGER.info("Hello!")
        self.assert_equal(1, 1)
        self.assert_true(1 == 1)
        self.assert_in(1 in [1, 2])
        self.assert_none(None)

        with self.assert_raises(RuntimeError) as cm:
            raise RuntimeError('foo')

        self.assert_equal(str(cm.exception), 'foo')


sequencer = systest.setup("my_sequence")

sequencer.run(MyTestCase("1"),
              (
                  MyTestCase("2"),
                  [
                      MyTestCase("3"),
                      MyTestCase("4")
                  ]
              ),
              MyTestCase("5"))

sequencer.report_and_exit()

The output is:

Name: my_sequence
Date: 2016-02-02 18:42:40.446213
Node: erik-VirtualBox
User: erik

---------------------------------------------------------------

Name: my_testcase_1
Description:

    Test case description.

Hello!

my_testcase_1: PASSED in 0m 0s

---------------------------------------------------------------

Name: my_testcase_2
Description:

    Test case description.

Hello!

my_testcase_2: PASSED in 0m 0s

---------------------------------------------------------------

Name: my_testcase_3
Description:

    Test case description.

Hello!

my_testcase_3: PASSED in 0m 0s

---------------------------------------------------------------

Name: my_testcase_4
Description:

    Test case description.

Hello!

my_testcase_4: PASSED in 0m 0s

---------------------------------------------------------------

Name: my_testcase_5
Description:

    Test case description.

Hello!

my_testcase_5: PASSED in 0m 0s

---------------------- Test summary begin ----------------------

[
    [
        my_testcase_1: PASSED,
        (
            my_testcase_2: PASSED,
            [
                my_testcase_3: PASSED,
                my_testcase_4: PASSED
            ]
        ),
        my_testcase_5: PASSED
    ]
]

Execution time: 0m 0s
Result: PASSED (passed: 5, failed: 0, skipped: 0, xpassed: 0, xfailed: 0)

----------------------- Test summary end -----------------------

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

systest-5.10.0.tar.gz (23.0 kB view details)

Uploaded Source

Built Distribution

systest-5.10.0-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file systest-5.10.0.tar.gz.

File metadata

  • Download URL: systest-5.10.0.tar.gz
  • Upload date:
  • Size: 23.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.7

File hashes

Hashes for systest-5.10.0.tar.gz
Algorithm Hash digest
SHA256 fcc9a21763a3e8055aa6f944b26d1f1f2389674547cc3a1164baa73d6b0ae9cc
MD5 49e292f0f02ce00eb6f93bc0b34ac21c
BLAKE2b-256 d7a2f952c96a027b74d1a71ca47dd7e52964cc73c4764609e88555705dfe181d

See more details on using hashes here.

File details

Details for the file systest-5.10.0-py3-none-any.whl.

File metadata

  • Download URL: systest-5.10.0-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.6.7

File hashes

Hashes for systest-5.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fbed78184d32b30fb1b3ceaaf08fcc17fa1826e2978347665efd857af7c7c5d0
MD5 b1f530318fef74bf6bfc91d987b0a4b2
BLAKE2b-256 44b8e1c02376620c985967b325e8b44dfb7bbd043365773f24ffc5bd4c449a95

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