Theme Unit Test

This step in theme testing correlates to a WordPress export file that you can import into a WordPress installation to test your Theme.

For theme authors, this is only one step in testing your Theme. See Theme testing for a full guide.

Setup

Top ↑

Test Environment Setup

  1. Clone the theme test data file themeunittestdata.wordpress.xml from the GitHubGitHub GitHub is a website that offers online implementation of git repositories that can easily be shared, copied and modified by other developers. Public repositories are free to host, private repositories require a paid subscription. GitHub introduced the concept of the ‘pull request’ where code changes done in branches by contributors can be reviewed and discussed before being merged be the repository owner. https://github.com/ repository https://github.com/WPTT/theme-unit-test (last updated 30/January/2020).

Or Download a copy from https://raw.githubusercontent.com/WPTT/theme-unit-test/master/themeunittestdata.wordpress.xml

  1. Import test data into your WordPress install by going to Tools => Import => WordPress
  2. Select the XML file from your computer
  3. Click on “Upload file and import”.
  4. Under “Import Attachments,” check the “Download and import file attachments” box and click submit.
    Note: You may have to repeat the Import step until you see “All Done” to obtain the full list of Posts and Media.

Top ↑

I18N Test Data

– Japanese Test Data

Top ↑

WordPress Settings

Adjust WordPress settings as follows:

  • Settings -> General: set the Site Title to something fairly long, and set the Tagline to something even longer. These settings will facilitate testing how the Theme handles these values.
  • Settings -> Reading: set “Blog pages show at most” to 5. This setting will ensure that index/archive pagination is triggered.
  • Settings -> Discussion: enable Threaded Comments, at least 3 levels deep. This setting will facilitate testing of Theme comment list styling.
  • Settings -> Discussion: enable Break comments into pages, and set 5 comments per page. This setting will facilitate testing of Theme paginating link markup/styling.
  • Settings -> Permalinks: ensure that a non-default permalink setting is selected, e.g. “Month and name”. This setting will facilitate stepping through the Theme Unit Tests.

Create at least two Custom Menus:

  • Long Menu: All included Pages
  • Short Menu: A menu of 2-3 Pages

Top ↑

Template Hierarchy Index Pages

When viewing any Template Hierarchy Index page, including the default index page (index.php), and (if applicable) Blog Posts Index (home.php), Date Archives (archive.php), CategoryCategory The 'category' taxonomy lets you group posts / content together that share a common bond. Categories are pre-defined and broad ranging. Archives (category.php), TagTag Tag is one of the pre-defined taxonomies in WordPress. Users can add tags to their WordPress posts along with categories. However, while a category may cover a broad range of topics, tags are smaller in scope and focused to specific topics. Think of them as keywords used for topics discussed in a particular post. Archives (tag.php), or Author Archives (author.php):

  • Posts display correctly, with no apparent visual problems or errors.
  • Posts display in correct order.
  • Correct number of posts display (as per setting in Settings > Reading).
  • Page navigation displays and works correctly.
  • Debugger returns no PHPPHP PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML. http://php.net/manual/en/intro-whatis.php. errors, warnings, or notices.
  • The browser reports no JavaScriptJavaScript JavaScript or JS is an object-oriented computer programming language commonly used to create interactive effects within web browsers. WordPress makes extensive use of JS for a better user experience. While PHP is executed on the server, JS executes within a user’s browser. https://www.javascript.com/. errors.

Top ↑

Static Front Page

If the Theme includes either a front-page.php or a home.php template file, go to Dashboard -> Settings -> Reading, and set the Front Page to display a Static Page (use any existing Page), and set the Blog Posts index to another Static Page (e.g. “Lorem Ipsum”).

  • The Front Page displays properly, and as intended
  • The Blog Posts index page displays properly
  • Debugger returns no PHP errors, warnings, or notices
  • The browser reports no JavaScript errors

Top ↑

404 Page

  • The 404 page displays properly
  • Some content is displayed, more than merely the basic “Error 404 – Page Not Found” message – such as some helpful text, a search form, a list of Post or Pages, etc.
  • Debugger returns no PHP errors, warnings, or notices
  • The browser reports no JavaScript errors

Top ↑

Search Results Page

  • The Search Results page displays properly, with search query results displayed.
  • Debugger returns no PHP errors, warnings, or notices
  • The browser reports no JavaScript errors

Top ↑

Blog Posts Index Page

Test the following posts when viewing the Blog Posts Index page. Post Titles in the test data correlate with section titles below.

Top ↑

Scheduled Post

  • Should not be displayed by the Theme (status “scheduled”, rather than “publish”).

Top ↑

Draft Post

  • Should not be displayed by the Theme (status “draft”, rather than “publish”).

Top ↑

Layout Test

  • Displays properly as a “Sticky Post.”
  • Page navigation links display and work properly.

Top ↑

Readability Test

  • Displays “Read More” link properly.
  • “Read More” link works properly (links to single post at “More” tag location).

Top ↑

Post Format Tests (All)

  • If Theme supports Post Format Type, Post displays as intended in the index view

Top ↑

Post Format Test: Gallery

  • Gallery images display as intended in the index view

Top ↑

Post Format Test: Image (Linked)

  • Image displays as intended in the index view
  • Image does not overflow the content area

Top ↑

Post Format Test: Image (Attached)

  • Image displays as intended in the index view
  • Image does not overflow the content area

Top ↑

Post Format Test: Video

  • Video displays as intended in the index view
  • Video does not overflow the content area

Top ↑

This Post Has No Body

  • Lack of body text should not adversely impact the layout.

Top ↑

(no title)

  • Lack of post title should not adversely impact layout.
  • Post permalink should be displayed. Making the post date a permalink is a great solution. See Twenty Ten for an example.

Top ↑

Many Categories & Many Tags

  • Theme must incorporate both the “Tag” and the “Category” taxonomies in some manner.
  • Large number of categories/tags should not adversely impact layout.

Top ↑

Protected Test With Secret Password

  • Password form should be displayed.
  • Post content should not be displayed.
  • Comments should not be displayed.
  • Once password is entered, post or excerptExcerpt An excerpt is the description of the blog post or page that will by default show on the blog archive page, in search results (SERPs), and on social media. With an SEO plugin, the excerpt may also be in that plugin’s metabox. displays properly.

Top ↑

Single Post

Test the following posts when viewing a single post (single.php). Each section title matches a post title in the test data.

Top ↑

Layout Test

  • Displays page navigation links properly.
  • Page navigation links work properly (link to correct page).
  • Post permalink links to Page 1.

Page 2

  • Paragraphs are styled correctly.
  • Left, Center, Right, Justify aligned paragraphs align properly.

Page 3

  • h1-h6 elements are styled (as appropriate).
  • blockquote, cite styled (as appropriate).
    • BlockBlock Block is the abstract term used to describe units of markup that, composed together, form the content or layout of a webpage using the WordPress editor. The idea combines concepts of what in the past may have achieved with shortcodes, custom HTML, and embed discovery into a single consistent API and user experience. quotes should be indented or otherwise distinct from paragraph text.
    • If the Theme uses a background image or quote symbol, make sure displays correctly on both short and long quotes.
  • span with style and ASCII characters should display properly.
  • table, tr, th, td are styled (as appropriate).
  • dl (dt, dd), ul, ol, li styled (as appropriate).
    • Nested lists should be indented correctly.
  • The following HTMLHTML HTML is an acronym for Hyper Text Markup Language. It is a markup language that is used in the development of web pages and websites. tags should be styled appropriately to ensure semantic meaning of each tag is preserved: address, a, big, cite, code, del, em, ins, kbd, pre, q, s, strong, sub, sup, tt, var.
    • Note: abbr and acronym require no special styling. Also, s may be address but was deprected with HTML 4 and can be left with no special styling as well.
  • div, span maintain proper block or inline display, and styled (as appropriate).

Top ↑

Readability Test

  • The content should be generally readable.
  • Styling should not negatively impact readability: foreground/background contrast, font family, font size, line height, paragraph width, paragraph spacing.

Top ↑

Images Test

Page 1

  • Un-Captioned Image Alignment Tests
    • Images are aligned properly: Center, Left, Right, None.
    • Check caption styles on first image.
    • Images should not have a border unless it’s part of design.

Page 2

  • Captioned Image Alignment Tests
    • Images are aligned properly: Center, Left, Right, None.
    • Check caption styles on first image.
    • Images should not have a border unless it’s part of design.

Page 3

  • Other Image Tests
    • Wide Image (Resized) Test
      • Image should display properly, and should be resized as specified.
      • SidebarSidebar A sidebar in WordPress is referred to a widget-ready area used by WordPress themes to display information that is not a part of the main content. It is not always a vertical column on the side. It can be a horizontal rectangle below or above the content area, footer, header, or any where in the theme. must not be pushed to the bottom of the page.
    • Wide Image (Not Resized) Test
      • Wide image overflows properly (such as using max-width CSSCSS CSS is an acronym for cascading style sheets. This is what controls the design or look and feel of a site. rule or overflow CSS rule).
      • Sidebar must not be pushed below content due to image overlap.
    • Thumbnails
      • Thumbnails display properly.

Page 4

  • Floats are cleared properly for floated element (thumbnail image) at the end of the Post Content.

Top ↑

Post Format Tests (All)

  • If Theme supports Post Format type, Post displays as intended in the single-post view.

Top ↑

Post Format Test: Gallery

  • Gallery displays correctly (check for spacing after gallery).
  • Gallery image thumbnails link to image post.

Top ↑

Post Format Test: Image (Linked)

  • Image displays as intended in single-post view.
  • Image does not overflow the content area.

Top ↑

Post Format Test: Image (Attached)

  • Image displays as intended in single-post view.
  • Image does not overflow the content area.

Top ↑

Post Format Test: Video

  • Video embeds work.
  • Embedded video does not push sidebar(s) below content due to overlap.
  • $content_width should have an appropriate value defined.

Top ↑

Post Format Test: Audio

  • Enclosure links work properly.

Top ↑

Post With Long Title

Long Post Title with long non-breaking string: If you say it loud enough, you’ll always sound precocious; Supercalifragilisticexpialidocious!

  • Test title line height.
  • Look for potential overflow issues if the theme has a small title area.

Top ↑

This Post Has No Body

  • Post displays properly and should not impact the layout.

Top ↑

(no title)

  • Post displays properly.
  • A link to the singular view of the post is recommended to be displayed. Making the post date a permalink (see Twenty Ten for an example) is a great solution.

Top ↑

Many Categories / Many Tags

  • Theme incorporates both the “Tag” and “Category” taxonomies in some manner.
  • Category links work correctly.
  • Categories display properly without adversely impacting design.
  • Tag links work correctly.
  • Tags display properly without adversely impacting design.

Top ↑

Protected Test With Secret Password

  • Password input form displays properly.
  • When correct password (secret) is entered, the post and comments are displayed.

Top ↑

Comment Test

  • Comments are displayed correctly.
  • Threaded comments display correctly.
  • Comment pagination displays correctly.
  • Author comment is styled (as appropriate).
  • User avatars are displayed properly.
  • Comment form displays properly for both logged in/logged out users.
  • When logged in as admin, edit links are displayed and work correctly.
  • HTML is displayed properly in comments, especially lists and block quotes.

Top ↑

Comments Disabled

  • Comment form does not display.
  • “Comments are disabled” notice is displayed.

Top ↑

Many Trackbacks

  • All trackbacks are displayed properly, with no overlap.

Top ↑

Pages

Test the following pages (page.php) by viewing the page that matches the section titles below.

Top ↑

Page With Comments

  • Tags, Categories, and Post date/time stamp should not be displayed.
  • Comment list and comment reply form are displayed.

Top ↑

Page With Comments Disabled

  • Comment list and comment reply form are not displayed.
  • No “Comments Disabled” message should be displayed.
  • Layout not adversely impacted by minimal page content.

Top ↑

Parent Page / Child Page 1 / Child Page 2

  • Extra credit for displaying parent and/or child when viewing pages within hierarchy.

Top ↑

Clearing Floats

  • The last item in this page’s content is a floated image. Make sure any elements after it are clearing properly.

Top ↑

Misc Pages

Tests for search.php and 404.php.

Top ↑

Search Results

  • Search results page is helpful.
  • Search query is displayed.

Top ↑

Not Found

  • 404 page is present, and has helpful information.

Top ↑

General

Top ↑

  • Test with a large number of categories or pages in the menu, and test with multiple levels deep in the menus.
  • If custom menus are enabled, test the layout both with custom menus enabled and with the fallback navigation menus (no custom menu enabled).

Top ↑

Widgets

  • All widgets display correctly.
  • The default WordPress widgets should work correctly in all widgetized areas.
  • If the Theme uses custom widgets, they should work correctly. (Custom widgets are programmatically added by the Theme to the list of available widgets in Appearance > Widgets.)
  • Test all available widgets in all available widgetized areas in the Theme layout.
  • Content that appears in widgetized areas by default (hard-coded into the sidebar, for example) should disappear when widgets are enabled from Appearance > Widgets.

Top ↑

Screenshot

  • The screenshot should accurately show the Theme design.
  • Make sure it doesn’t show customized headerHeader The header of your site is typically the first thing people will experience. The masthead or header art located across the top of your page is part of the look and feel of your website. It can influence a visitor’s opinion about your content and you/ your organization’s brand. It may also look different on different screen sizes. colors or an uploaded logo that wouldn’t appear by default.

Top ↑

Theme authors should only be using links that point directly to a website specifically for the theme; an appropriate website page for the theme; or a reasonably related URLURL A specific web address of a website or web page on the Internet, such as a website’s URL www.wordpress.org giving more information about the theme. Using anchor text for search engine gains will not be accepted.


Top ↑

Theme Testing

This Unit Test is just one step in Theme testing. Continue to Theme testing for the full guide.

Top ↑

Contributing

You can contribute to improving the Theme Unit Test by opening issues and submitting pull requests.

Top ↑

Last updated: