unittest Framework
Jump to navigation
Jump to search
An unittest Framework is an Python-based unit testing framework.
- Context:
- It can include Software Libraries, such as
unittest.mock
. - …
- It can include Software Libraries, such as
- Counter-Example(s):
- See: XUnit, Unit Test, Test Automation Framework, Unit Testing Framework.
References
2022
- https://pythonspot.com/python-unit-testing/
- QUOTE:
- The module unittest is a complete unit testing framework.
- An alternative to the unittest module is pytest.
- There are several other unit testing modules: Nose, Tox, unittest2 and unittest.mock.
- QUOTE:
2018
- (Wikipedia, 2018) ⇒ https://en.wikipedia.org/wiki/List_of_unit_testing_frameworks#python Retrieved:2018-12-12.
Name | xUnit | Generators | Fixtures | Group Fixtures | Source | Remarks |
---|---|---|---|---|---|---|
unittest | Yes | Yes | Yes | No | (sometimes referred to as “PyUnit"), has been included in Python standard library from Python version 2.1.[1] |
2020
- https://docs.python.org/3/library/unittest.html
- QUOTE: ... The unittest unit testing framework was originally inspired by JUnit and has a similar flavor as major unit testing frameworks in other languages. It supports test automation, sharing of setup and shutdown code for tests, aggregation of tests into collections, and independence of the tests from the reporting framework.
To achieve this, unittest supports some important concepts in an object-oriented way:
- QUOTE: ... The unittest unit testing framework was originally inspired by JUnit and has a similar flavor as major unit testing frameworks in other languages. It supports test automation, sharing of setup and shutdown code for tests, aggregation of tests into collections, and independence of the tests from the reporting framework.
- test fixture
- A test fixture represents the preparation needed to perform one or more tests, and any associated cleanup actions. This may involve, for example, creating temporary or proxy databases, directories, or starting a server process.
- test case
- A test case is the individual unit of testing. It checks for a specific response to a particular set of inputs. unittest provides a base class, TestCase, which may be used to create new test cases.
- test suite
- A test suite is a collection of test cases, test suites, or both. It is used to aggregate tests that should be executed together.
- test runner
- A test runner is a component which orchestrates the execution of tests and provides the outcome to the user. The runner may use a graphical interface, a textual interface, or return a special value to indicate the results of executing the tests.
- ↑ "25.3. unittest – Unit testing framework – Python 2.7.10 documentation". python.org. https://docs.python.org/2/library/unittest.html. Retrieved 23 June 2015.