System test framework with serial and parallel execution.
Project description
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file systest-5.12.0.tar.gz
.
File metadata
- Download URL: systest-5.12.0.tar.gz
- Upload date:
- Size: 22.9 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86f8af231e67da286a12d3cb5d76851c463f69115f118f4cbdc0f1b900965df0 |
|
MD5 | 8dcfbe0169202656fe535bd82a88380e |
|
BLAKE2b-256 | 62812907642023d622f4b08113b9908b3a36927f74a64085b4c19c9aad58bc2c |
File details
Details for the file systest-5.12.0-py3-none-any.whl
.
File metadata
- Download URL: systest-5.12.0-py3-none-any.whl
- Upload date:
- Size: 10.8 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4aa8b6ed374e674e828a24f45065c38196f6bc1b7fdc2217f96f0b719d268ca7 |
|
MD5 | fc5086d4186fa16c037961328bde7285 |
|
BLAKE2b-256 | 432ec5894d811e273b17bb461630a8896d55686d44b56265d58f00897094d56e |