Python Unit Testing Competency (Intermediate Level)

  • 18m
  • 18 questions
The Python Unit Testing Competency (Intermediate Level) benchmark measures your ability to recognize use cases for fixtures test suites and integrate your Python sources with their tests using the PyCharm IDE. You will be evaluated on your skills in using pytest and doctest to define and automate tests for your Python applications. A learner who scores high on this benchmark demonstrates that they have the skills to implement advanced Python testing using the unittest unit testing framework and test Python code using pytest and doctest.

Topics covered

  • apply markers to tests and run only those tests which contain specific marker, and skip the execution of specific tests unconditionally
  • apply module and function level scopes for fixtures functions
  • create a readme file for a Python module which bundles documentation and testing in a single file
  • create a script which uses the unittest framework by using the PyCharm IDE
  • debug test scripts using the python debugger
  • define a script testing out multiple functions in the source using the PyCharm IDE
  • execute tests defined in multiple scripts using pytest
  • group test cases into a test suite and execute them using a test runner
  • parametrize calls to a function an application using the pytest parametrize decorator
  • pick the tests to execute based on the test function names
  • recall how to set doctest to ignore whitespace in the output of tests tests
  • recognize when a test script will benefit from the use of fixture functions
  • recognize where doctests can be placed within source code
  • use fixtures to define common operations for test functions
  • use the ELLIPSIS directive to account for unpredictable output in doctests
  • use the ELLIPSIS directive to check if the code raises exceptions for incorrect input values
  • use the makeSuite function to initialize a test suite
  • use the setUp and tearDown functions to define common operations for tests in a script