[TIP] Parametrize tests for unit or integration testing
andrea.crotti.0 at gmail.com
Tue Feb 4 11:21:22 PST 2014
2014-02-01 Mateusz Łoskot <mateusz at loskot.net>:
> This is my first post here, so hello everyone.
> I was searching through the list archives and I stumbled upon this post
> in which Benji mentions about writing
> "a parameterized test and apply the same test twice. Once in an
> environment where the "real" thing is used and once where the "stub" is used"
> AFAIU, the idea is to write test(s) once, then parametrize for use in both
> modes, as unit tests or integration tests.
> Could anyone explain or give example how to implement
> such parametrization?
> Perhaps Benji is still around and could explain the original technique?
> I'm using Python 3.2 or 3.3 and I write my tests using
> unittest and mock (or unittest.mock) modules.
> So, I'm interested in using those to to achieve the parametrized
> tests for unit/integration testing modes.
> Best regards,
I always split integrations and unit tests in different directories,
so it's to spot what is what and I can run unit tests in a commit
We also have often unit and integration tests for the same modules,
but that's just two different files..
More information about the testing-in-python