Embed Example
This is a snippet from the default render template in our test site. The results for the current item as rendered on the Functional test channel (FUN) are embedded in the page, followed by the expected result.
The actual render template includes JavaScript that compares the two results and changes the background colour of the divs to reflect a passed or failed test.
Smartsite SXML | Copy Code |
---|---|
<h3 class="section">Actual Result</h3> <se:embed whitespace="remove"> <se:parameters> <se:parameter name="location"> {channel.crosslink(itemdata.number(),FUN)} </se:parameter> <se:parameter name="resultformat"> <code id="actualresult" class="sxml bggray">{sxml.encode(string.xmldecode(this.result(), 'xml'), false)}</code> </se:parameter> <se:parameter name="error" whitespace="preserve"> <code id="actualresult" class="sxml bggray">EXCEPTION: {string.tolower(this.error.innerexception.type(), whitespace=preserve)}</code> </se:parameter> <se:parameter name="default"> <code id="actualresult" class="sxml bggray"></code> </se:parameter> </se:parameters> </se:embed> <h3 class="section">Expected Result</h3> <se:viewsource whitespace="remove" recurse="true"> <se:parameters> <se:parameter name="xml"> {itemdata.rawfield('expectedresult')} </se:parameter> <se:parameter name="resultformat"> <code id="expectedresult" class="sxml bggray">{this.result()}</code> </se:parameter> <se:parameter name="default"> <code id="expectedresult" class="sxml bggray"></code> </se:parameter> </se:parameters> </se:viewsource> |