Wednesday, September 11, 2019

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://ift.tt/2JDHRTz" rel="nofollow">PyCharm Professional</a>: <a href="https://ift.tt/2JDHRTz" 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://ift.tt/2tzXV5e" rel="payment">Support Test & Code - Python Testing & Development</a></p><p>Links:</p><ul><li><a href="https://ift.tt/2upHCZj" title="pytest changelog" rel="nofollow">pytest changelog</a></li><li><a href="https://ift.tt/32ExCsa" title="pytest deprecations and removals" rel="nofollow">pytest deprecations and removals</a></li><li><a href="https://ift.tt/2nL8dbT" 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://ift.tt/32y5dnp" title="Parametrizing test functions — pytest documentation" rel="nofollow">Parametrizing test functions — pytest documentation</a></li><li><a href="https://ift.tt/2N9yLnD" title="pytest fixtures — pytest documentation" rel="nofollow">pytest fixtures — pytest documentation</a></li></ul>

from Planet Python
via read more

No comments:

Post a Comment

TestDriven.io: Working with Static and Media Files in Django

This article looks at how to work with static and media files in a Django project, locally and in production. from Planet Python via read...