pytest is the package / tool to do unit testingPlaywright is a modern browser automation library.
Shiny provides a Playwright controller that understands Shiny-specific widgets:
from pathlib import Path
from playwright.sync_api import Page
from shiny.playwright import controller
from shiny.run import run_shiny_app
APP = Path(__file__).parent / "app.py"
def test_species_filter(page: Page):
with run_shiny_app(str(APP)) as app:
page.goto(app.url)
radio = controller.InputRadioButtons(page, "species")
text = controller.OutputText(page, "n_rows")
radio.expect_choices(["Adelie", "Chinstrap", "Gentoo"])
radio.set("Chinstrap")
text.expect_value("68 penguins")code/demos/testing/
├── app.py ← the Shiny app
└── test_app.py ← tests
Or from the repo root:
Shiny provides typed controllers for every input and output type:
PyCon US 2026. chendaniely/pycon-2026-shiny