Run a test case multiple times with different data
Project description
datadriven
datadriven allows you to run a test case multiple times with different data. It was designed to work
with unittest.TestCase
test methods, any test runner (nose, nose2, unittest, unittest2 and
pytest), in Python 2.7 or 3.7+.
Usage
import datadriven
class SomeTestCase(unittest.TestCase):
@datadriven.datadriven(
caseA=datadriven.Args(first="foo"),
caseB=datadriven.Args("hello", second="world"),
)
def test_method(self, first, second=None):
...
This is the equivalent of writing:
import datadriven
class SomeTestCase(unittest.TestCase):
def test_method(self, first, second=None):
...
def test_method_caseA(self):
self.test_method("foo")
def test_method_caseB(self):
self.test_method("hello", "world")
The only difference is that when wrapped with @datadriven
, the test test_method
won't be really executed.
License
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
datadriven-1.0.0.tar.gz
(6.9 kB
view hashes)
Built Distributions
Close
Hashes for datadriven-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 796abff2973dc4692ee8736f6e619829b172078d188d74e0eea13a0978e8e596 |
|
MD5 | 910b83ada951a5208c1dfeb5364bd378 |
|
BLAKE2b-256 | da4f61cc2287cc6aa3444e05a0b10bc5533ea9921c07665df32691053902e631 |
Close
Hashes for datadriven-1.0.0-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a63c3c5a43b66f444bf408cfb99f9a38339bbb1625efe39233db258ac46ce3c9 |
|
MD5 | 12d5a39848da62f4ecef4d670db31895 |
|
BLAKE2b-256 | 41d50750f8f3d9fd30cecfa72bd5eaaa47e6d876d5972c91dfbb869c223e967e |