In this post, I will illustrate 3 simple examples for testing an HTML website using Assertible. The examples described in this post are perfect for continuously smoke-testing your site from a continuous integration pipeline or deploy script.
These examples assume you have an Assertible account with a valid web service and test. If you don't have a web service, just click here.
1. Validate HTML structure
The most fundamental way to test an HTML website in Assertible is to check that the HTML is valid. This can be done using the HTML validation assertion. The HTML validation assertion utilizes the W3C HTML Validation and is a robust way to check markup while also delivering fine-grained valuable error messages.
From the Assertible dashboard, navigate to (or create) a test, and click the Assertions configuration tab. In the Assertion type drop-down, select HTML Validation
This assertion does not take any input. If the assertion fails, you will recieve detailed information about the nature and location of the validation error.
2. Link check
Another fundamental way to test an HTML website is to ensure all links on a document are valid. In many cases, users of your website may never tell you that links are broken and will simply leave.
Broken links are very simple to check in Assertion using our Link check assertion. The Link check assertion tests the following elements:
From the Assertible dashboard, navigate to (or create) a test, and click the Assertions configuration tab. In the Assertion type drop-down, select Link check
The link checker does not need any input configuration. If the assertion fails, you will recieve detailed information about the structure of the error
3. Check for specific HTML elements
In many test scenarios, it's important to check that specific HTML elements exist on a served page. For example:
- Validating page titles
- Validating DOM element exists
- Validating CSS classes
From the Assertible dashboard, navigate to (or create) a test, and click the Assertions configuration tab. In the Assertion type drop-down, select Assert text body.
The Assert text body configuration takes two inputs:
- Comparison This drop-down only takes the value contains although we plan to expand to more comparisons
- Target value This is the text you wish to ensure exists on the page
Once you have finalized your assertion configuration, click Save assertion. If the assertion fails, you will recieve detailed information about the structure of the error
More test cases
The 3 assertions described in this post can ensure a large percentage of common errors are dealt with. The value in using Assertible to test these failure scenarios is that you can automate the checks from your continuous integration pipeline or deploy script to continuously test your website.
Because Assertible supports multiple assertions per test, we highly recommend combining the HTML validation and Link check assertions with other types of assertions, such as:
POSTing a form
- check that a user can log-in and log-out
These can all be combined into a single test:
More docs (who doesn't love docs?):
:: Christopher Reichert
The easiest way to test and
monitor your web services
Reduce bugs in web applications by using Assertible to create an automated QA pipeline that helps you catch failures & ship code faster.Get started with GitHubSign up for free
New feature: autocomplete for variables 11/03/2017