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:
- 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.
Reference:
- python3 doc: unittest.mock — getting started
- python3 doc: unittest.mock — mock object library
- python3 doc: unittest — Unit testing framework - assert methods
- python3 doc: unittest — Unit testing framework - class unittest.TestCase(methodName='runTest')
...is a unit testing framework for Shell scripts - namely Bash.
This is a very light weight (as in one file) unit testing library for Bash scripts. It functions similarly to Java's JUnit.
You do not need to touch any of your shell scripts to run unit tests against it. That is to say, that your original source code does not need to know about the BSTL in order for the unit tests to work.