Python Test Automation | Anexia Digital Engineering

Python test automation for reliable releases.

Every change should be verifiable before it reaches your users. We build Python tests with pytest, unittest and nose2, add browser checks with Selenium and Playwright, and anchor both where your team works, in the repository and in CI.

Verified, not assumed

For us, automated tests are not an appendix to a project but part of its architecture. They capture what an application must do and flag deviations before a release exposes them. Anexia Digital Engineering combines unit, integration and functional tests with browser checks along your critical user journeys, drawing on experience from more than 100 Python projects.

  • Readable suites

    pytest finds test cases automatically, prepares test data through fixtures and runs variants reproducibly through parametrisation. Existing unittest tests keep running alongside.

  • Stable browser paths

    Selenium and Playwright verify sign-in, forms and navigation across several browsers. Robust selectors and explicit waits keep the runs dependable.

  • Clear failure signals

    Traces, DOM snapshots, screenshots and documented error messages show why a run failed, so your team can judge every release on evidence.

  • Anchored in CI

    We integrate Python tests into your repository and CI, agree on checkpoints with your team and hand over configuration and guidance, so the suite stays in your hands.

Python tests at code level

Python test automation starts with one question. Which business rules must an application never break? From there we derive tests for defined inputs and expected results, guard existing areas against regressions and make changes to Python code verifiable. Whether pytest, unittest or nose2 is the right foundation depends on your existing tests, your team and your integration requirements, not on preference.

pytest as the basis for Python tests

pytest is an open-source Python testing framework. It discovers test modules and functions automatically through naming conventions, reports plain assert statements in a readable way and extends through a plugin architecture, for simple and complex functional tests alike. We structure suites so that databases, temporary files and input variants are prepared transparently. Reusable fixtures provide test data, databases and temporary directories, with scopes and teardown set up to match. Parametrised test cases, expected exceptions, marks and, where needed, plugins or pytest hooks verify variants and project-specific flows reproducibly, and the pytest command line runs exactly the tests you need.

According to the project description, pytest runs existing unittest suites without further changes. We therefore migrate established test code step by step instead of rewriting it, and check edge cases in your specific suite. Two limits are worth discussing early. pytest runs tests and reports findings, but it does not prove the absence of defects and replaces neither deliberate test case selection nor integration, E2E or security testing. It also does not handle SIGTERM and SIGQUIT specially for fixture cleanup. If a process is killed, database connections or files can remain open, which has to be covered operationally.

unittest from the standard library

unittest is the object-oriented testing framework of the Python standard library. TestCase, TestSuite, TestRunner, fixtures, assertions and test discovery give tests a clear structure. We turn business rules into TestCase classes with assertions such as assertEqual, assertTrue and assertRaises, and organise shared setUp, tearDown and cleanup routines so your team can extend them. Modules, classes and individual methods can be run selectively with python -m unittest, for example as test_module.TestClass.test_method. Test methods typically start with test, and discovery and file structure have to match the project configuration and its conventions.

We replace external or stateful dependencies in a controlled way using unittest.mock, Mock, MagicMock and patch, checking calls, arguments, namespaces and specifications as well as the reset of every patch. Poorly chosen patch targets, missing specs or patches left in place would otherwise distort results or affect other tests. Unit tests check isolated units. Integrations, infrastructure, real data, UI flows and production conditions call for additional integration, E2E or system tests, and test design and functional coverage remain engineering work.

nose2 for established test suites

nose2 is a standalone Python testing framework and the successor to nose. It extends unittest, discovers test modules and functions by convention and adds configuration files and plugins. Starting from the start directory, nose2 searches packages, test directories and usually lib or src directories for modules whose names begin with test, such as test.py or test_models.py, and loads unittest.TestCase subclasses and matching test functions. We review package layout, start and top-level directory and file names, integrate existing test cases and parametrisations, and configure plugins for log capture, output buffering, debugging or collect-only runs.

nose2 is not fully compatible with nose. Some project layouts and nose plugins need adjustment, and custom plugins have to be rewritten for the nose2 plugin API. When invoked through python setup.py test, nose2 largely takes over the run itself, may be incompatible with some packages according to its documentation, accepts no command-line arguments and always runs every test. We therefore use nose2 mainly where an existing suite needs to run reproducibly, and document how local runs and CI execution fit together.

Stance

Testing means ownership

A test suite is only worth the trust your team places in its results. Flaky runs that nobody takes seriously do more harm than good. That is why we start with business rules and critical user journeys rather than a coverage figure, and build Python tests so that a red run always says something specific.

Anexia Digital Engineering works as a long-term engineering partner. Our team of more than 40 specialists in Austria and Germany has been building software since 2006 and has delivered more than 100 Python projects. The Anexia Group operates management systems certified to ISO 27001, ISO 9001 and ISO 14001, with software development within their scope.

How Python test automation takes shape

A test nobody trusts verifies nothing.

Outcome

What your team gets

The result is not a collection of scripts but test automation with Python that your team understands, runs and keeps building on. Every check has a purpose, and every result carries a clear meaning for the next release.

  • A reproducible suite built on pytest, unittest or nose2
  • Browser checks for Chromium, Firefox and WebKit
  • Documented checkpoints and failure signals in CI
  • Traces, screenshots and reports for failure analysis
  • Guidance for maintenance, extension and operation

Browser checks in Python test automation

Unit tests secure business logic, but only a browser shows whether sign-in, forms and navigation actually work. For web applications we extend the suite with browser checks that repeatedly exercise critical flows across the agreed browser coverage. Changes and releases can then be assessed on evidence instead of someone clicking through critical paths by hand before every release.

Selenium WebDriver for Python tests

Selenium is an open-source browser automation project. Through WebDriver, an interface standardised by the W3C, it controls browsers locally or via a Selenium server the way a person would. In Python, our tests navigate pages, locate DOM elements, perform inputs and user actions and verify expected results. Test code remains largely reusable across common browsers, and Selenium Grid distributes runs in parallel across machines, browser versions and operating systems. We integrate browser and driver configuration together with Selenium Manager.

Dynamic DOM changes quickly lead to race conditions and flaky tests. We therefore synchronise with explicit waits and robust selectors, and never combine implicit and explicit waits, because that produces wait times that are hard to predict. Browsers, drivers, network, test data and any Grid infrastructure have to be compatible and set up reproducibly. Selenium Manager can manage missing drivers and supported browsers, but it does not resolve faults rooted in the application or the environment. Actual coverage always depends on driver, version and environment.

Playwright for E2E testing

Playwright is an open-source framework for web automation and E2E testing. Its Python library drives Chromium, Firefox and WebKit through a single API, locally or in CI, headless or with a visible browser window. For central user flows we write stable tests with role or label locators and retrying web-first assertions, so each step targets the visible behaviour of the application. Separate runs per browser use isolated browser contexts and can run in parallel or through sharding in your existing CI.

When a run fails, traces, DOM snapshots, network data, console messages, screenshots or videos provide the basis for analysis. We maintain test data, authentication states and browser installations and hand them over to your team. Playwright automates browsers and web applications, so backend, API and Python unit tests still need suitable tools and setups. It also requires a compatible Python and operating system environment with installed browsers, whose binaries are set up with playwright install and managed reproducibly in CI. Compute requirements and third-party environments remain project-specific.

Our assessment is based on the primary sources of each project, the pytest documentation, the unittest documentation, the nose2 documentation, the Selenium documentation and the Playwright documentation for Python. How Python tests fit into quality assurance and security testing is covered in more detail in our Quality & Security Testing section. Product names belong to their respective owners.

Questions on Python test automation

Let's build. Make every release verifiable.

Tell us about your application, your existing tests and the flows that must never fail. Together we will work out which Python tests and browser checks matter most and how they fit into your CI.