MyPage is a personalized page based on your interests.The page is customized to help you to find content that matters you the most.


I'm not curious

Unit Testing with Python

Course Summary

This course follows on from the Pluralsight Python Fundamentals course, and has more detail about unit testing with Python. We will cover libraries and frameworks such as unittest, doctest and py.test. The aim is to help you to write unit tests that imp


  • +

    Course Syllabus

    ● Unit Testing with Python - Basic Example Using unittest
        ◦ Course Overview
        ◦ Module Overview
        ◦ A first Test Case
        ◦ Another test case, explanation of 'Test Runner'
        ◦ A test case using assertRaises, explanation of 'Test Suite'
        ◦ skip a test case, marking it Work In Progress
        ◦ using setUp and tearDown - explanation of 'Test Fixture'
        ◦ re-introduce the skipped test case, get it to pass.
        ◦ test case design - test case names as specification.
        ◦ Arrange - Act - Assert - Cleanup
        ◦ unittest documentation.
        ◦ module summary.
    ● Why and When Should You Write Unit Tests?
        ◦ Module Outline
        ◦ Four reasons for unit testing
        ◦ Understanding what to build
        ◦ Documenting the Units
        ◦ Designing the Units
        ◦ Detecting Regression
        ◦ Limitations of Unit Testing
        ◦ Testing as part of your personal development process
        ◦ Test Last
        ◦ Test First
        ◦ Test Driven
        ◦ Continuous Integration
        ◦ Module Review
    ● Using Pytest for Unit Testing in Python
        ◦ Module Outline
        ◦ Motivation for looking at pytest
        ◦ Defining and running a simple test case
        ◦ Interpreting failure information
        ◦ Asserting the contents of collections
        ◦ Built-in helper functions - 'raises' and 'skip'
        ◦ Adding a Test fixture by using '@pytest.fixture'
        ◦ Using built-in test fixture resources - 'tmpdir'
        ◦ Using pytest to run 'unittest' tests
        ◦ Module Review
    ● Testable Documentation with Doctest
        ◦ Module Outline
        ◦ What doctest is for, how it relates to unit testing
        ◦ Documenting a simple method with docstring examples
        ◦ Using different test runners to execute doctests
        ◦ Handling failing doctests
        ◦ Handling output that changes - dictionaries and floats
        ◦ Testing for exceptions: including tracebacks in doctests
        ◦ The ELLIPSIS directive: a wildcard for matching varying output
        ◦ Putting doctest regression tests in a separate file
        ◦ When to put doctests in a file, using approval testing
        ◦ Doctest for checking tutorial documentation
        ◦ Module Review
    ● Test Doubles: Mocks, Fakes and Stubs
        ◦ Module Outline
        ◦ What is a Test Double?
        ◦ Example using a Stub
        ◦ Using unittest.mock to create a Stub
        ◦ Stub example summary
        ◦ Example using a Fake
        ◦ Example using a Mock
        ◦ Example using a Spy
        ◦ Using unittest.mock to create a Spy and a Mock
        ◦ Example using a Dummy Object
        ◦ Choosing to use a particular kind of Test Double
        ◦ Using Monkeypatching to insert a Test Double
        ◦ Module Review
    ● Test Coverage and Parameterized Tests
        ◦ Module Outline
        ◦ Using a custom assert to reduce duplication
        ◦ Defining parameterized tests with unittest
        ◦ Defining parameterized tests with pytest
        ◦ Measuring coverage with pytest-cov
        ◦ Measuring coverage of unittest tests
        ◦ Using coverage data to add tests to legacy code
        ◦ Good and bad uses for coverage metrics
        ◦ Module Review

     


Course Fee:
USD 29

Course Type:

Self-Study

Course Status:

Active

Workload:

1 - 4 hours / week

This course is listed under Open Source , Development & Implementations and Quality Assurance & Testing Community

Related Posts:

Attended this course?

Back to Top

Awards & Accolades for MyTechLogy
Winner of
REDHERRING
Top 100 Asia
Finalist at SiTF Awards 2014 under the category Best Social & Community Product
Finalist at HR Vendor of the Year 2015 Awards under the category Best Learning Management System
Finalist at HR Vendor of the Year 2015 Awards under the category Best Talent Management Software
Hidden Image Url

Back to Top