https://github.com/geekie/datadriven
Run a test case multiple times with different data
https://github.com/geekie/datadriven
datadriven python testing
Last synced: 11 months ago
JSON representation
Run a test case multiple times with different data
- Host: GitHub
- URL: https://github.com/geekie/datadriven
- Owner: geekie
- License: apache-2.0
- Created: 2022-01-05T00:30:45.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-01-19T19:30:42.000Z (over 4 years ago)
- Last Synced: 2025-06-04T17:17:56.501Z (about 1 year ago)
- Topics: datadriven, python, testing
- Language: Python
- Homepage:
- Size: 12.7 KB
- Stars: 1
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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
```py
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:
```py
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
[Apache-2.0 License](./LICENSE)