Microformats testsuite

Overview of test-fixture

Introduction

The test-fixture is a description of a group of software tests embedded into simple HTML. It is designed as a microformat, but as it has not yet been through the community review process, it is called a POSH pattern. The idea is to build a series of pages containing test-fixtures into a full test-suite. This specification should be considered a draft. Contents are subject to change. It is provided here for reference and as a basis for discussion and ongoing development.

Author

Glenn Jones

Structure

Key

Single occurrence required
Single occurrence optional
Zero or More occurrences

Properties

summary
The title of the test-fixture
description
An expanded piece of text about the test-fixture
format
The format to be tested
author
The authors of the test-fixture, these are hCards
output
This is an example output which would be expected form the test.
The child 'type' property can be used to describe the output format.
The child 'value' property a URL to link to the example.
assert
The assert is a description of a test.
The child 'test' property describes the element to test.
The child 'result' property describes expected result for the test.
The child 'comment' is an expanded piece of text about the test.
history
The history of changes to test-fixture, these are hcalendar events

Embeding microformats to test within the same page

Where you are testing microformats you can embed them into the same page as the test-fixture. As the test-fixture itself contains microformats such as hCards we need to define what section of the page to parse.

Some parsers such as UfXtarct and Sumo already have this ability, for other I have provided a simple proxy service. It allows you to define a URL of a page and the ID of any element and it returns a HTML page containing just that element.

For the sake of consistency within the microformats test-suite the ID should be ID “uf”.

Currently supported test methods

Exmaple


<h1 class="summary">hCard 1 - single occurrence test</h1>
<p class="description">
This page was designed to test the values of a hcard 
which are meant to have only a single occurrence parsed correctly.
</p>

<p>From: <a href="default.htm"><span class="format">hCard</span> testsuite 1.0</a></p>
    
<p class="author vcard"> 
Author: 
<a class="url fn" href="http://www.glennjones.net/">Glenn Jones</a> 
<a class="org url" href="http://www.madgex.com/">Madgex</a>
</p>
    
<p>Output examples: 
<ul>
<li class="output"><a class="url" href="hcard1.js"><span class="type">JSON</span></a></li>
<li class="output"><a class="url" href="hcard1.xml"><span class="type">XML</span></a></li>
</ul>
</p>
    
    
<p>Tests:</p>
<table id="assetTable" cellpadding="0" cellspacing="0">
<thead>
     <tr>
     <th>Test</th>
     <th>Result</th>
     <th>Comment</th>
     </tr>
</thead>
<tbody>
        <tr class="assert">
        <td class="test">vcard[0].fn</td>
        <td class="result">IsEqualTo("John Doe")</td>
        <td class="comment">The fn (formatted name) is a singular value</td>
    </tr>
    <tr class="assert">
        <td class="test">vcard[0].n.given-name[0]</td>
        <td class="result">IsEqualTo("John")</td>
        <td class="comment">The n (name) is a singular value</td>
    </tr>
    <tr class="assert">
        <td class="test">vcard[0].bday</td>
        <td class="result">IsEqualTo("2000-01-01T00:00:00-0800")</td>
        <td class="comment">The bday (birthday) is a singular value</td>
    </tr>
    <tr class="assert">
        <td class="test">vcard[0].class</td>
        <td class="result">IsEqualTo("Public")</td>
        <td class="comment">The class is a singular value</td>
    </tr>
    <tr class="assert">
        <td class="test">vcard[0].geo.latitude</td>
        <td class="result">IsEqualTo("30.267991")</td>
        <td class="comment">The geo is a singular value</td>
    </tr>
    <tr class="assert">
        <td class="test">vcard[0].rev</td>
        <td class="result">IsEqualTo("2008-01-01T13:45")</td>
        <td class="comment">The rev is a singular value</td>
    </tr>
    <tr class="assert">
        <td class="test">vcard[0].role</td>
        <td class="result">IsEqualTo("Designer")</td>
        <td class="comment">The role is a singular value</td>
    </tr>
    <tr class="assert">
        <td class="test">vcard[0].sort-string</td>
        <td class="result">IsEqualTo("John")</td>
        <td class="comment">The sort-string is a singular value</td>
    </tr>
    <tr class="assert">
        <td class="test">vcard[0].tz</td>
        <td class="result">IsEqualTo("-05:00")</td>
        <td class="comment">The tz is a singular value</td>
    </tr>
    <tr class="assert">
        <td class="test">vcard[0].uid</td>
        <td class="result">IsEqualTo("com.johndoe/profiles/johndoe")</td>
        <td class="comment">The uid is a singular value</td>
    </tr>
</tbody>
</table> 
    
    
<p>History:</p>
<ul>
<li class="history vevent">
    <span class="summary">Created</span>: 
    <abbr class="dtstart" title="2008-04-08">8 April 2008</abbr> 
    <span class="description">by Glenn Jones</span>

</li>
</ul>
    
    
    
</div>





 Some rights reserved