HTML and CSS Reference
Listing 2.6 demonstrates a simple FitNesse test that checks the http-equiv meta tag in the head to make sure
it's properly specifying UTF-8. The first three lines set the classpath. Then, after a blank line, the next line
identifies the type of fixture as an HtmlFixture. (There are several other kinds, but HtmlFixture is the common
one for testing web applications.)
The external page at http://www.elharo.com/blog/ is then loaded. In this page, we focus on the element named
meta that has an id attribute with the value charset . This will be the subject for our tests.
The test then looks at two attributes of this element. First it inspects the content attribute and asserts that its
value is text/html; charset=utf-8 . Next it checks the http-equiv attribute of the same element and asserts
that its value is content-type .
Listing 2.6. A FitNesse Test for <meta name="charset" http-equiv="Content-Type"
content="text/html; charset=UTF-8" />
|Element Focus|charset |meta|
|Attribute |content |text/html; charset=utf-8|
This test would be embedded in a Wiki page. You can run it from a web browser just by clicking the Test button,
as shown in Figure 2.4 . If all of the assertions pass, and if nothing else goes wrong, the test will appear green
after it is run. Otherwise, it will appear pink. You can use other Wiki markup elsewhere in the page to describe
Figure 2.4. A FitNesse page
[View full size image]