I'm regularly surprised by the low quality of web pages. The problem may arise from the forgiving nature of Browsers, they allow developers to be unaware of the mess they're making. I ran a quick check on more than 50 pages from my favourites list. 90% were such poor quality that they shouldn't have been released. I'm disappointed. Many of the problems can be fixed in a few minutes. If you care there might be an answer here. I've provided further documentation, source code and the like so that you can roll your own tests.
This article is intended for people who:
Last edited 2006-05-30
I regularly check the quality of markup on web pages. Most are surprisingly poor.
By spending a few minutes per page any developer, can often fix all problems. Even when he can't he is, at least, aware of them.
This article was prepared to help those who want to check page quality, as a normal part of their work.
To illustrate the consequences: If a company has a particularly bad site I often go elsewhere however good the pages might look in the browser. I don't believe many others currently do that. But it could become popular, it's very easy!
To run the checks, as you develop, you need:
The tests can be very simple and a natural part of the development cycle. Two assemblies are provided in the kit one for the free Lite DLL the other for the Standard or Pro DLL. The following code fragment uses the MBUnit framework, with VB.NET (version 8), to test 3 pages. It would be scarcely longer if it tested a dozen pages.
''' Validates miscellaneous HTML pages.
''' This is setup against a customised validator and can be calibrated in the manual/desktop interface. Should be calibrated for any changes in the configuration, and also for different versions of the validator assembly/dll. Should the test pages change check the calibration.
<TestFixture(), FixtureCategory("Web Page Validation"), Importance(TestImportance.Critical)> Public Class TestPages
Dim ValidationTool As Manager = New Manager
<TestFixtureSetUp()> Public Sub FixtureSetUp()
ValidationTool.CheckLinks = False
<RowTest(), Row("http://localhost/ValidateWeb/BaseHTML.htm", 0, 0),_
Row("http://localhost/ValidateWeb/ErrorXHTML.htm", 20, 20),_
Row("http://localhost/ValidateWeb/ExtraBackslashHTML.htm", 0, 0)>_
Public Sub TestPage(ByVal PageUri As String, ByVal ErrorLimit As Integer, ByVal WarningLimit As Integer)
' Remove line continuations above to make code work!
Assert.LowerEqualThan(ValidationTool.Validator.CseResultNumErrors, ErrorLimit, "There are not " & ErrorLimit.ToString & " or less errors... " & PageUri & ".")
Assert.LowerEqualThan(ValidationTool.Validator.CseResultNumWarnings, WarningLimit, "There are not " & WarningLimit.ToString & " or less errors... " & PageUri & ".")
<TestFixtureTearDown()> Public Sub FixtureTearDown()
I encourage those who like to test their code regularly to add tests like this.
For those who are regularly testing large numbers of pages on a web site, say, before and after publication, this technique might also fit in.