Test and Code: 87: Paths to Parametrization – from one test to many

There’s a cool feature of pytest called parametrization.
It’s totally one of the superpowers of pytest.

It’s actually a handful of features, and there are a few ways to approach it.
Parametrization is the ability to take one test, and send lots of different input datasets into the code under test, and maybe even have different output checks, all within the same test that you developed in the simple test case.

Super powerful, but something since there’s a few approaches to it, a tad tricky to get the hang of.

Sponsored By:

Support Test & Code – Python Testing & Development

Links:

<p>There&#39;s a cool feature of pytest called parametrization.<br> It&#39;s totally one of the superpowers of pytest.</p> <p>It&#39;s actually a handful of features, and there are a few ways to approach it.<br> Parametrization is the ability to take one test, and send lots of different input datasets into the code under test, and maybe even have different output checks, all within the same test that you developed in the simple test case.</p> <p>Super powerful, but something since there&#39;s a few approaches to it, a tad tricky to get the hang of.</p><p>Sponsored By:</p><ul><li><a href=”https://testandcode.com/pycharm” rel=”nofollow”>PyCharm Professional</a>: <a href=”https://testandcode.com/pycharm” rel=”nofollow”>Try PyCharm Pro for 4 months. Offer good through June 10. Try out Pro features like integrated coverage and profiling, and extended support for Django, Flask, Pyramid, Cython, and more.</a> Promo Code: TESTNCODE2019</li></ul><p><a href=”https://www.patreon.com/testpodcast” rel=”payment”>Support Test & Code – Python Testing & Development</a></p><p>Links:</p><ul><li><a href=”https://docs.pytest.org/en/latest/changelog.html” title=”pytest changelog” rel=”nofollow”>pytest changelog</a></li><li><a href=”https://docs.pytest.org/en/latest/deprecations.html#deprecations” title=”pytest deprecations and removals” rel=”nofollow”>pytest deprecations and removals</a></li><li><a href=”https://pragprog.com/book/bopytest/python-testing-with-pytest” title=”Python Testing with pytest” rel=”nofollow”>Python Testing with pytest</a> &mdash; Test function parametrization is in chapter 2. Fixture parametrization is in chapter 3.</li><li><a href=”https://docs.pytest.org/en/latest/parametrize.html” title=”Parametrizing test functions — pytest documentation” rel=”nofollow”>Parametrizing test functions — pytest documentation</a></li><li><a href=”https://docs.pytest.org/en/latest/fixture.html#fixture-parametrize” title=”pytest fixtures — pytest documentation” rel=”nofollow”>pytest fixtures — pytest documentation</a></li></ul>
Planet Python

Leave a Reply

Your email address will not be published. Required fields are marked *