views:

440

answers:

4

Hello

Recently, I thought about how can I improve the quality of the projects, by using Continuous checking of xHTML source at Continuous Integration machine.

Look, we have a project

http://sourceforge.net/projects/jtidy - jTidy JTidy is a Java port of HTML Tidy, a HTML syntax checker and pretty printer.

It can validate the xHTML through a command-line interface. Or this tool can be extended in the way we need, because all source code are open.

We can overwrite every Selenium validation method, such as assertTextPresent, or any other, so it will be calling the jTidy(by providing current state's HTML source), and if some errors or warnings will occur - it can be saved to Continuous Integration machine build's logs - so any project's related can see this info.

We can not to rewrite all the Selenium methods, to integrate this call on every step, but to make this calls where we want(after DOM manupulations).

Yes, we can use W3C markup validators for our sites, but there isn't any possibility to validate not initial state of page's source with this validators. After page creation, there might be lots of DOM manipulations which can produce markup errors/warnings - we can find it immediately with this scheme.

One of the benefits of using Continuous integration is that you have quick feedback from code - how it integrates with existing code base, test whether unit and functional tests pass. Why not to get an additional useful info, such as instant xHTML markup validation status. The earlier we identify the problem, the easier to fix it.

I haven't found anything on this theme in google yet. And want to know, what do you think about this idea?

+1  A: 

Seems like a worthwhile idea.

I've done two similar things with CI before:

  1. I've used Ant's XMLValidate task to validate static xhtml files as part of the build process

  2. I've used httpunit to pull pages that I then parsed as xml

But the idea of tying into Selenium to validate the content inherently during a functional test run is novel to me.

Jeffrey Fredrick
+1  A: 

I think, that idea is brilliant but it is very hard to implement it from scratch. But this idea is like evolution of build/quality validation process, so it will be released as ready-to-use tool with documentation someday.

A: 

Great in principle, but I'm not quite sure how to call it from Selenium. I'd love to see documentation explaining how to run it from Selenese, or from PHPUnit.

sampablokuper
+1  A: 

Good idea! - in fact I just had exactly the same idea and was just checking to see if anyone had done it before - argh! Looks like you beat me to it :)

I was thinking along the lines of capturing and auto-submitting each page hit by selenium to the w3c HTML and CSS validtors (by file rather than link so state is held) - failing on any errors. I like the jtidy idea though.

lucas1000001