Choose testing framework
alvarofpp opened this issue · 4 comments
Most used test libraries/frameworks:
- PyTest
- UnitTest
I liked UnitTest:
Because it is part of Python's standad library;
Define directory and naming standards, which I particularly like;
It is one of the most used frameworks for Python, always showing as one of the first choices in lists like these:
- https://www.softwaretestinghelp.com/python-testing-frameworks/
- https://blog.testproject.io/2020/10/27/top-python-testing-frameworks/
- https://www.zenesys.com/blog/unit-testing-frameworks-in-python
- https://docs.python-guide.org/writing/tests/
Also has a tutorial from Socratica.
And is compatible with Coverage, which is a tool to discover test coverage in Python. This one will be very useful for us.
@marcocspc PyTest is above UnitTest in two of the top three lists you have placed.
I really like the style of creating tests using classes, but PyTest has some other benefits when compared to UniTest, like: UnitTest cannot run tests in parallel, but PyTest can. Also PyTest is compatible with Coverage too.
Some packages and their respective testing frameworks:
UnitTest:
PyTest:
I've used both UnitTest and PyTest on urnai previously. I've personally found PyTest to be more flexible and easier to use, allowing me to do not only unit tests but also more general integration tests quite easily, by just prepending "test_" to a funcion name.
- Pytest: 2 votes.
- Unittest: 1 vote.