Java Reference
In-Depth Information
illustrate its use. The following is a basic Xpand template that creates the output
HTML report from a test requirements model. As we reference the scenario
reference from our requirements, we need to link a source folder so that Xpand
can resolve the reference. This is done in the project properties, as shown in
Figure 7-4.
Figure 7-4
Edit Source Folder dialog
«
IMPORT
requirements»
«
DEFINE
Main
FOR
Model»
«
FILE
(title == null ? "requirements" : title) + ".html"»
<html>
<head><title>«title»</title></head>
<body>
<h1>«title» Report</h1>
«
EXPAND
index FOR this-»
<hr/>
«
EXPAND
groupContent
FOREACH
groups-»
</body>
</html>
«
ENDFILE
»
«
ENDDEFINE
»
«
DEFINE
index
FOR
Model-»
<h3>Contents</h3>
<ul>«
EXPAND
groupIndex
FOREACH
groups-»</ul>
«
ENDDEFINE
»
«
DEFINE
groupIndex
FOR
RequirementGroup»
<li><a href="#group«id»">«name-»</a></li>
«
IF
!requirements.isEmpty-»
<ul>«
EXPAND
requirementIndex
FOREACH
requirements-»</ul>
«
ENDIF
»
«
IF
!children.isEmpty-»
<ul>«
EXPAND
groupIndex
FOREACH
children-»</ul>
«
ENDIF
»
Search WWH ::
Custom Search