File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Testing and the fly likes TDD for HTML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "TDD for HTML" Watch "TDD for HTML" New topic
Author

TDD for HTML

Sahil Reddy
Ranch Hand

Joined: Jan 24, 2011
Posts: 145
How to employ TDD for static HTML pages ???

Precisely, how to write tests for HTML pages ???

Regards
Reddy
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30913
    
158

I've never done TDD for a static page. If I was, I would use a tool like Selenium though:

I expect to see a field with the label "first"
write it
I expect to see a field with the label "last"
write it
I expect to see a submit button
write it

You said static though so I guess this would be more headers? For a single static page, the question feels like how would you TDD a word document? You could if you had requirements, but would it be necessary.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Sahil Reddy
Ranch Hand

Joined: Jan 24, 2011
Posts: 145
By TDD... I just wanted to mean that i want to have safety-net so that , i may ensure everything is fine.........
Essentially, i just want to have tests may be that could be written afterwards...

For Instance

1. All pages are present
2. Required elements are present as expected


Are these things possible with Selenium ???
Regards
Reddy
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30913
    
158

Yes. Selenium let's you check the presence of elements. As does jwebunit. For static pages, jwebunit might be better because you don't have to worry about page interactions.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: TDD for HTML