20030323 Sunday March 23, 2003

TagUnit for the Display Tag Simon Brown was nice enough to whip up an application for testing the display tag library. Amazingly enough, it passes all the tests! At first glance, Simon's TagUnit seems to just test getters and setters and if classes are loadable. I think these are great tests, but for truly robust tests for the display tag, I think we need tests that test specific behavior (i.e. you click on a column heading and it sorts that column). IMO, WebTest is probably the best candidate. The problem is, it might take awhile to write these tests, and no one seems to have much time to work on the display tag project. Any volunteers? ;-) Posted in Java at Mar 23 2003, 08:24:10 AM MST 2 Comments

Comments:

Sorry Matt, I forgot to mention in my e-mail that the WAR file I sent you just runs the automatic tests for a tag library and you're exactly right in they test that getters, setters and that tag/TEI classes are loadable. However, this is just a small part of the TagUnit framework because also included are a whole load of tags that can be used on a JSP page to perform assertions. For example, there's an <assertEquals> tag to compare two pieces of content. There are also <assertNotEquals>, <assertContains> and <assertMatches> tags for further comparing content. We can also assert for the existence of attributes that a tag introduces into the page with the <assertPageContextAttribute> tag, and we can also run tests over the TLD file to check the contract that a tag provides. For example, you might want to automate testing the tag specification so that you know when somebody modifies characteristics of the tag, including the names of a tag's attributes and whether they are required and accept request-time expressions. Essentially, TagUnit provides a way to write JUnit style tests using custom tags within a JSP page rather than the Cactus method of using Java code. This allows you to build up a suite of tests based around how the tags are used on a JSP page, rather than simply calling their methods from within Java code. Apologies for not writing any of these tests for the display taglib - it was late. ;-)

Posted by Simon Brown on March 23, 2003 at 09:18 AM MST #

Just reading my comment back ... I put angle brackets around the tag names so they got zapped! TagUnit has tags including assertEquals, assertNotEquals, assertContains (string contains substring), assertMatches (string matches regex), assertPageContextAttribute (checks for existence of attribute that a tag sets/introduces into the page), assertBodyContent, assertAttribute, etc. Sorry about that!

Posted by Simon Brown on March 23, 2003 at 03:23 PM MST #

Post a Comment:
  • HTML Syntax: Allowed
Click me to subscribe
Matt Raible is a Web Architect who enjoys developing applications with open source technologies. Contact me for rates.
« January 2009
SunMonTueWedThuFriSat
    
1
2
3
5
6
7
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
       
Today

Recent Entries

Tag Cloud