Skip to content

testing

Craig Parkinson edited this page Jun 24, 2026 · 1 revision

Testing involves ensuring that requirements have been fully met by using appropriate tools and techniques to verify that a product or service works.

Awareness: Understand that testing of code is required to ensure accuracy.

Working: Define testing conditions and tests, along with executing them.

Practitioner: Manage the planning of system and tests, co-ordinating both functional and non-functional specifications provide advice and guidance on test planning. Identify process improvements and contribute to the definition of best practice.

Expert: Set guidance and advice on testings, including testing methodologies and paradigms.

The table below shows which skill level each grade should be working at within three to six months of starting a new role.

Grade Trainee Data Scientist (EO) Associate Data Scientist (HEO) Data Scientist (SEO) Senior Data Scientist (G7) Lead Data Scientist (G6)
Skill level Awareness Working Practioner Expert Expert

General resources

PyTest is a commonly used testing library used in the ONS. There are plenty of how to guides and information on their website.

Writing good unit tests in Python with Ease - starts with “why test”, then goes into details.

Test driven development (TDD) is the fundamental testing paradigm employed throughout the ONS. There are lots of resources out there for TDD IBM.

Awareness

There are many different ways to classify tests, with Unit tests forming a fundamental building block. Here are some blog posts that describe different types of testing in Python. At awareness level you should be able to run tests and recognise different kinds of tests, whilst learning how to write unit tests.

Working

CS50P has been mentioned elsewhere in this learning roadmap. See CS50P: Week 5 Unit Tests for an overview of error handling and PyTest.

YouTube: How to Write Unit Tests in Python

Learning Hub: Introduction to Unit Testing

Real Python: Getting started with testing in Python (PyTest).

You can categorise unit tests in different ways. One way is positive vs negative testing.

Getting the right information when Pytest runs

Useful PyTest command line options

Coverage reports with pytest-cov

Practitioner

Article: Five Advanced PyTest Fixture Patterns

Ed's helpful demo of PyTest Examples is especially useful if you are interested in parameterised testing.

Book: Cosmic python - this has some really useful concepts around repository patterns and testability.

Video: Stop using mocks (for a while) Pycon talk by the author of obey testing goat and cosmic python.

Video: Stop mocking start testing - Talk by some google engineers about mocks and testing.

Clone this wiki locally