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: 2020-05-30 11:41:49.712832
Node: erik-GR8
User: erik

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

Name: my_testcase_1
Description:

    Test case description.

Hello!

my_testcase_1: PASSED in 0 seconds

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

Name: my_testcase_2
Description:

    Test case description.

Hello!

my_testcase_2: PASSED in 0 seconds

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

Name: my_testcase_3
Description:

    Test case description.

Hello!

my_testcase_3: PASSED in 0 seconds

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

Name: my_testcase_4
Description:

    Test case description.

Hello!

my_testcase_4: PASSED in 0 seconds

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

Name: my_testcase_5
Description:

    Test case description.

Hello!

my_testcase_5: PASSED in 0 seconds

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

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

Execution time: 0.02 seconds
Result: PASSED (5 passed, 5 total)

----------------------- 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.14.0.tar.gz (23.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: systest-5.14.0.tar.gz
  • Upload date:
  • Size: 23.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for systest-5.14.0.tar.gz
Algorithm Hash digest
SHA256 3b1540fd899fa05b6f16f763eb9009cdf937f70be115bdf32a4acc1d2b952f3f
MD5 dd8f08e413be7b6ee03c2f860067209d
BLAKE2b-256 06f800e55e4416dce23db6213fccb9def24941d3a9953e5efe490d591e5d1ae3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: systest-5.14.0-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for systest-5.14.0-py3-none-any.whl
Algorithm Hash digest
SHA256 37b61b498b08f04261b6266016ddf52543e9dcab9fe5dc625fc72f5159a01900
MD5 7e4ab5e0faed048d7efa3b3b9374e86b
BLAKE2b-256 cd85cd2951e217b95e970a6353bcbff09e478c504913f0de1b78993b6e0a5ee3

See more details on using hashes here.

Supported by

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