How to Build an Automated Technical AEO Testing Pipeline With CI/CD
Automated technical SEO testing brings search discoverability into the same process your developers already trust. Engineering teams test code before every deployment. Yet a single release can still add noindex to a template, block a crawler in robots.txt or move key text into JavaScript. Nobody notices until traffic and AI citations drop weeks later.
This guide shows how to add technical AEO tests to a CI/CD pipeline. It covers robots.txt, structured data, canonicals, raw HTML content, status codes and sitemaps. The test suite and GitHub Actions workflow are included and tested.
Why do discoverability regressions happen during deployments?
Short answer: Search and AI visibility depend on small details spread across templates, configuration files and server settings. Developers change these for good reasons, and nothing in a normal test suite checks the side effects on crawlers.
Common examples include a staging robots.txt copied to production, a new framework version that renders content on the client, and a template change that drops canonical tags. Another is a redesign that replaces server-rendered pricing with a widget. Each one passes unit tests and breaks discoverability.
How do you integrate automated technical SEO testing into CI/CD pipelines?
Short answer: Build the site, start a preview server, run a test suite against it and block the merge if critical tests fail. The tests run on every pull request, so problems are caught before release.
The pipeline has five steps:
- Developer submits a pull request.
- Build application: the CI runner builds the site as it would for production.
- Run automated AEO tests: the suite tests the preview build.
- Tests passed: the change can be merged and deployed.
- Critical tests failed: the merge is blocked and engineering is notified.
What does the test suite check?
Short answer: Seven checks cover the most common regressions: robots.txt rules, status codes and redirects, noindex, canonicals, JSON-LD syntax, key content in raw HTML and sitemap integrity.
The suite uses pytest and reads its rules from one configuration file. Here is the repository layout:
aeo-tests/
aeo_config.yaml
requirements.txt
tests/
conftest.py
test_aeo.py
.github/
workflows/
aeo-tests.yml
The configuration lists the pages and phrases that must never break:
# Pages and rules that must never break in a deployment
base_url: https://www.example.com # overridden by the AEO_BASE_URL environment variable
sitemap: /sitemap.xml
sitemap_sample: 25 # how many sitemap URLs to status-check per run
bots_must_be_allowed: [Googlebot, Bingbot, OAI-SearchBot, Claude-SearchBot, PerplexityBot]
key_pages:
- path: /
must_contain: ["Example Co"]
- path: /pricing/
must_contain: ["Starter", "free trial"]
- path: /blog/
must_contain: ["Blog"]
The shared fixtures load the configuration and fetch each key page once, without running JavaScript:
import os
import pathlib
import pytest
import requests
import yaml
ROOT = pathlib.Path(__file__).resolve().parents[1]
UA = "Mozilla/5.0 (compatible; AEO-CI/1.0)"
@pytest.fixture(scope="session")
def cfg():
data = yaml.safe_load((ROOT / "aeo_config.yaml").read_text(encoding="utf-8"))
data["base_url"] = os.environ.get("AEO_BASE_URL", data["base_url"]).rstrip("/")
return data
@pytest.fixture(scope="session")
def http():
s = requests.Session()
s.headers["User-Agent"] = UA
return s
@pytest.fixture(scope="session")
def pages(cfg, http):
"""Fetch every key page once, without running JavaScript."""
out = {}
for page in cfg["key_pages"]:
out[page["path"]] = http.get(cfg["base_url"] + page["path"], timeout=20)
return out
How does automated technical SEO testing validate robots.txt?
Short answer: The test downloads robots.txt from the build and checks that every important crawler may fetch every key page. A copied staging file or a new Disallow rule fails the build.
The crawler list includes Googlebot, Bingbot and the AI search crawlers you want to keep. Our guide to robots.txt for AI crawlers explains which ones matter.
How do you run structured data regression tests?
Short answer: Parse every JSON-LD block on each key page and fail if any block is invalid JSON or has a node without a type. This catches broken templates before they reach production.
For deeper checks, add tests for required properties or broken @id references, as described in our guide to structured data for AEO.
How do you validate canonical tags?
Short answer: Each key page should have exactly one canonical tag that points to itself on the environment under test. Missing, duplicate or misdirected canonicals fail the test.
How do you test HTML content accessibility?
Short answer: Fetch each key page without JavaScript and confirm that required phrases, such as product names and plan names, appear in the raw HTML. If a phrase exists only after rendering, many AI crawlers will not see it.
This is the most valuable test for modern front ends. Our guide to JavaScript rendering for AI search explains why, and includes a Playwright script for comparing raw and rendered pages.
How do you test HTTP status codes, redirects and sitemaps?
Short answer: Key pages must return 200 with at most one redirect. The sitemap must be valid XML, and a sample of its URLs must return 200 on the build under test.
The sitemap test rewrites production URLs to the preview host, so it checks the new build rather than the live site. Here is the full test file:
"""Technical AEO regression tests. Run with: pytest -q"""
import json
import re
import xml.etree.ElementTree as ET
from urllib.parse import urlparse
from urllib.robotparser import RobotFileParser
import pytest
from bs4 import BeautifulSoup
SM = "{http://www.sitemaps.org/schemas/sitemap/0.9}"
def soup(resp):
return BeautifulSoup(resp.text, "html.parser")
def test_robots_txt_allows_key_bots(cfg, http):
r = http.get(cfg["base_url"] + "/robots.txt", timeout=10)
assert r.status_code == 200, "robots.txt is missing"
rp = RobotFileParser()
rp.parse(r.text.splitlines())
blocked = [(bot, p["path"]) for bot in cfg["bots_must_be_allowed"] for p in cfg["key_pages"]
if not rp.can_fetch(bot, cfg["base_url"] + p["path"])]
assert not blocked, f"robots.txt blocks key pages: {blocked}"
def test_key_pages_return_200_without_redirect_chains(pages):
for path, r in pages.items():
assert r.status_code == 200, f"{path} returned {r.status_code}"
assert len(r.history) <= 1, f"{path} has a redirect chain of {len(r.history)}"
def test_no_noindex_on_key_pages(pages):
for path, r in pages.items():
header = r.headers.get("X-Robots-Tag", "").lower()
metas = [m.get("content", "").lower() for m in
soup(r).find_all("meta", attrs={"name": re.compile("^(robots|googlebot)$", re.I)})]
assert "noindex" not in header and not any("noindex" in m for m in metas), \
f"{path} carries noindex"
def test_canonical_is_self_referencing(cfg, pages):
for path, r in pages.items():
tags = soup(r).find_all("link", rel="canonical")
assert len(tags) == 1, f"{path} has {len(tags)} canonical tags"
assert tags[0]["href"].rstrip("/") == (cfg["base_url"] + path).rstrip("/"), \
f"{path} canonical points to {tags[0]['href']}"
def test_structured_data_is_valid_json(pages):
for path, r in pages.items():
for block in soup(r).find_all("script", type="application/ld+json"):
try:
data = json.loads(block.string or "")
except json.JSONDecodeError as exc:
pytest.fail(f"{path} has invalid JSON-LD: {exc}")
nodes = data.get("@graph", [data]) if isinstance(data, dict) else data
assert all("@type" in n for n in nodes), f"{path} has a JSON-LD node without @type"
def test_key_content_is_in_raw_html(cfg, pages):
for page in cfg["key_pages"]:
text = soup(pages[page["path"]]).get_text(" ").lower()
missing = [p for p in page["must_contain"] if p.lower() not in text]
assert not missing, f"{page['path']} is missing {missing} in raw HTML (JavaScript only?)"
def test_sitemap_is_valid_and_urls_resolve(cfg, http):
r = http.get(cfg["base_url"] + cfg["sitemap"], timeout=20)
assert r.status_code == 200, "sitemap is missing"
root = ET.fromstring(r.content) # raises if the XML is broken
urls = [loc.text.strip() for loc in root.iter(SM + "loc")]
assert urls, "sitemap has no URLs"
bad = []
for url in urls[: cfg["sitemap_sample"]]:
# Check the same path on the build under test, not on production.
url = cfg["base_url"] + urlparse(url).path
status = http.head(url, timeout=15, allow_redirects=False).status_code
if status != 200:
bad.append((url, status))
assert not bad, f"sitemap lists URLs that do not return 200: {bad}"
How do you add Python and Playwright tests?
Short answer: The core suite needs only requests, BeautifulSoup and PyYAML, so it runs fast. Add Playwright tests in the same folder when you need to compare raw and rendered HTML or test interactive content.
Keep browser tests few and focused, because they are slower. A good split is fast raw HTML checks on every pull request and a fuller rendered crawl on a nightly schedule.
How do you integrate automated technical SEO testing with GitHub Actions?
Short answer: Add a workflow that runs on pull requests, builds the site, starts a preview server and runs pytest against it. Mark the job as a required status check so failures block merging.
name: Technical AEO tests
on:
pull_request:
branches: [main]
jobs:
aeo:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install test dependencies
run: pip install -r aeo-tests/requirements.txt
# Replace these two steps with your own build and preview commands.
- name: Build site
run: npm ci && npm run build
- name: Start preview server
run: |
npx serve -l 8080 dist &
npx wait-on http://localhost:8080
- name: Run AEO tests
env:
AEO_BASE_URL: http://localhost:8080
run: pytest -q aeo-tests/tests --junitxml=aeo-report.xml
- name: Notify engineering on failure
if: failure()
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
run: |
curl -s -X POST -H 'Content-type: application/json' \
--data "{\"text\":\"AEO tests failed on PR #${{ github.event.pull_request.number }}: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}" \
"$SLACK_WEBHOOK_URL"
Replace the build and preview steps with your own commands. For WordPress or other server-rendered sites, point AEO_BASE_URL at a staging environment instead of a local server.
How do you prevent deployments that introduce critical discoverability issues?
Short answer: In your repository settings, add a branch protection rule for main and make the AEO job a required status check. A pull request that fails the suite cannot merge until it is fixed.
We tested the suite against two builds of the same small site. The healthy build passed all seven tests. The second build had five planted regressions: OAI-SearchBot blocked, noindex on pricing, a broken JSON-LD node, pricing text moved into JavaScript and a sitemap URL returning 404. The suite caught all five:
FAILED tests/test_aeo.py::test_robots_txt_allows_key_bots
FAILED tests/test_aeo.py::test_no_noindex_on_key_pages
FAILED tests/test_aeo.py::test_structured_data_is_valid_json
FAILED tests/test_aeo.py::test_key_content_is_in_raw_html
FAILED tests/test_aeo.py::test_sitemap_is_valid_and_urls_resolve
5 failed, 2 passed
How do you create automated alerts for engineering teams?
Short answer: Send a message to the team channel when the suite fails, with a link to the run. The workflow above posts to Slack through a webhook stored as a repository secret.
Also schedule the same suite to run daily against production. That catches changes made outside the codebase, such as CDN rules or CMS settings. Our guide to AI crawler firewall configuration covers those network-level risks.
Frequently asked questions about automated technical SEO testing
Does automated technical SEO testing replace an SEO audit?
No. It guards against regressions on known rules. Audits still find new opportunities and problems that tests do not cover.
Which tests should block a deployment?
Block on noindex, robots.txt blocks, missing key content and broken status codes. Treat softer checks, such as title length, as warnings.
Can this work with WordPress?
Yes. Run the suite against a staging site after each theme or plugin update, or on a schedule against production.
How long do these tests take?
The raw HTML suite usually runs in seconds. Browser-based tests take longer, so run them less often or on fewer pages.
Who should own automated technical SEO testing?
Engineering should own the pipeline, with SEO or marketing owning the configuration file that lists key pages and phrases.
Next step
Start with five key pages and the seven tests above. Once the suite is stable, make it a required check and add a daily run against production.
Want more practical guides on automated technical SEO testing? Browse the latest articles on the Blippu blog.