How to automatically test your HTML content is correct?

On this page we show you how to specify a simple automated test assertion. A test assertion is a condition that you expect the returned <url> to fulfil at runtime every time your automated test suite executes.

If the actual behaviour is equal the expected behaviour at runtime, then the test <step> will be logged as a PASS, else it will be logged as a FAILURE.

One simple example: The following tests that the HTML source code that the specified <url> from below returns to the browser <contains> the sub string “Hello World”.

<?xml version="1.0" encoding="UTF-8" ?>
<testsuite>
    <userstory title="Test that 'Hello World' appears on the web page">
        <scenario>
            <step>
                <url>http://automateyourtests.com/demo_application/</url>
                <contains>Just another WordPress site</contains>
            </step>
        </scenario>
    </userstory>
</testsuite>

This tests that the HTML <contains> multiple specified sub strings.

<?xml version="1.0" encoding="UTF-8" ?>
<testsuite>
    <userstory title="Test that both of the phrases 'Just another WordPress site' and 'My blog' appear on the web page (logical and)">
        <scenario>
            <step>
                <url>http://automateyourtests.com/demo_application/</url>
                <contains>Just another WordPress site</contains>
                <contains>My blog</contains>
            </step>
        </scenario>
    </userstory>
</testsuite>

This tests that the HTML <notcontains> a specified sub string.

<?xml version="1.0" encoding="UTF-8" ?>
<testsuite>
    <userstory title="Test that the phrase 'Just another Joomla site' does NOT appear on the web page">
        <scenario>
            <step>
                <url>http://automateyourtests.com/demo_application/</url>
                <notcontains>Just another Joomla site</notcontains>
            </step>
        </scenario>
    </userstory>
</testsuite>

This tests that the HTML <notcontains> multiple specified sub strings.

<?xml version="1.0" encoding="UTF-8" ?>
<testsuite>
    <userstory title="Test that both of the phrases 'Just another Joomla site' and 'Just another Drupal site' do NOT appear on the web page (logical and)">
        <scenario>
            <step>
                <url>http://automateyourtests.com/demo_application/</url>
                <notcontains>Just another Joomla site</notcontains>
                <notcontains>Just another Drupal site</notcontains>
            </step>
        </scenario>
    </userstory>
</testsuite>

Warning: count(): Parameter must be an array or an object that implements Countable in /home/nemyoe7sj5jr/public_html/wp-includes/class-wp-comment-query.php on line 388