The importance of testing your SEO

Juampi Barreto
Studocu Tech
Published in
3 min readSep 2, 2022

--

Just like any other test suite, SEO tests will give your team confidence in your HTML structure and will prevent expensive mistakes.

Photo by <a href=”https://unsplash.com/@calamar_ete?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Ignacio Aguilar</a> on <a href=”https://unsplash.com/?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>
Photo by Ignacio Aguilar

Once upon a time, while developing a refactoring task on the search page, a developer accidentally deleted a noindex meta tag. The refactor passed the unit tests, the E2E tests, and the manual test from the QA engineer.

It got merged and deployed in less than a week, and the team (and the developer) called it a day.

Flash forward three months later, someone notices the search engines are ranking the site lower and lower. They soon discover that all of these pages are being indexed and ranked in google:

/search/how-to-test-seo
/search/how-to-test-seo?sort=popularity
/search/how-to-test-seo-in-php
etc.

The whole website was punished for duplicated content, with most of their crawling budget being spent on pretty irrelevant pages.

Immediately, the problem is located, and the revert process begins. The no index tag is added back and deployed. It takes time, but after two more months, the traffic on what matters is restored to its glory.

In big companies, an SEO Specialist can detect the problem during the indexing phase, and prevent it from affecting the ranking, but when you don’t have said specialist, teams can prevent these problems by testing their SEO.

Testing your SEO

What is Testing SEO? This article doesn’t refer to measuring SEO decisions by testing the results, but to performing certain assertions to make sure your SEO structure is as expected.

SEO Snapshot testing

For existing projects where the SEO structure is already defined, snapshot tests are a great starting initiative.

You can have in no time some assertions that will make sure the mistake from the past do not happen again.

In a nutshell, an SEO test can consist of a seed that generates a specific scenario. Let’s say we’re testing an article. We want to make sure the page title includes part of the article’s title, the canonical is there, the description includes part of the article, and the open-graph and Twitter tags are present.

Now, whenever a developer makes a change on the SEO Structure, they will have to manually update the seed and commit the changes, reducing the chance of an unwanted change.

Test-Driven SEO Development

If you have the luxury, I would recommend making SEO Testing an important step in your process.

Test-Driven SEO Development means that we first write our SEO tests and expectations, and then we add our tags to satisfy them. To be able to succeed at it, we must make SEO speccing a mandatory step in our process. Whenever we have to create a new page or edit an existing one, the specifications must contain the expected SEO structure, so the developer can start making the tests already.

Generic SEO checks

There are some things that should always exist, and for those, it would also be great to have generic checks.

An example of these checks is to include an alt attribute to all images or to have a max of one h1 header per page, and to respect header hierarchy.

Conclusion

It is known that tests can slow down development, but, as it’s also known, they can catch bugs better than humans (if they are properly written, of course).

If your project is heavily dependent on SEO traffic, I suggest you make this a priority. Your team can start with Snapshot testing, slowly refactor them into assertion tests, and include the SEO structure in the specs as an end goal.

--

--