Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
FitNesseRoot.files.testResults.RestFixtureTests.LetTests.20160309220659_1_0_0_0.xml Maven / Gradle / Ivy
<?xml version="1.0"?>
<testResults>
<FitNesseVersion>v20150424</FitNesseVersion>
<rootPath>RestFixtureTests.LetTests</rootPath>
<result>
<counts>
<right>17</right>
<wrong>0</wrong>
<ignores>0</ignores>
<exceptions>0</exceptions>
</counts>
<runTimeInMillis>249</runTimeInMillis>
<content><div class="collapsible closed"><ul><li><a href='#' class='expandall'>Expand</a></li><li><a href='#' class='collapseall'>Collapse</a></li></ul>
<p class="title">Included page: <a href="RestFixtureTests.SetUp">.RestFixtureTests.SetUp</a> <a href="RestFixtureTests.SetUp?edit&amp;redirectToReferer=true&amp;redirectAction=" class="edit">(edit)</a></p>
<div><table>
<tr class="slimRowTitle">
<td>script</td>
<td colspan="2"><span class="pass">smartrics.rest.test.fitnesse.fixture.HttpServerFixture</span></td>
</tr>
<tr class="slimRowColor0">
<td>check</td>
<td>is started</td>
<td><span class="pass">true</span></td>
</tr>
<tr class="slimRowColor9">
<td colspan="3"><span class="pass">reset resources database</span></td>
</tr>
</table>
</div>
</div>
<br/>Usages of LET (See also <a href="RestFixtureTests.PostTests">PostTests</a> for more examples) <br/><br/><i>LET used to extract values from header, using regular expressions</i><br/><br/><table>
<tr class="slimRowTitle">
<td><span class="pass">Table: Rest Fixture</span></td>
<td colspan="4"><a href="http://localhost:9876">http://localhost:9876</a></td>
</tr>
<tr class="slimRowColor0">
<td>setBody</td>
<td colspan="4">&lt;resource&gt;&lt;name&gt;Bill&lt;/name&gt;&lt;data&gt;Some data on Bill&lt;/data&gt;&lt;/resource&gt;</td>
</tr>
<tr class="slimRowColor1">
<td>POST</td>
<td><div><a href='http://localhost:9876/resources/'>/resources/</a></div></td>
<td><span class="pass"><div>201</div></span></td>
<td><div>Location&nbsp;:&nbsp;/resources/2<br/>Content-Length&nbsp;:&nbsp;0<br/>Server&nbsp;:&nbsp;Jetty(6.0.2)</div></td>
<td><span class="pass"><div>no-body</div></span></td>
</tr>
<tr class="slimRowColor0">
<td>let</td>
<td>id</td>
<td>header</td>
<td><div>Location:/resources/(.+)</div></td>
<td><div>2</div></td>
</tr>
</table>
<br/>The regex is applied to each header. On the first match the first group is extracted and<br/>assigned as value to the label <i>id</i>.<br/><br/>Labels are global and can be shared across rest fixture instances.<br/><br/><i>LET used to extract values from XML body via XPath</i><br/><i>Values are re-usable across instances of RestFixture</i> <br/><br/>Here follows an usage of the previously extracted <i>id</i>.<br/>This example also shows how to use let to extract data from the XML body of a response using XPath.<br/><br/><table>
<tr class="slimRowTitle">
<td><span class="pass">Table: Rest Fixture</span></td>
<td colspan="4"><a href="http://localhost:9876">http://localhost:9876</a></td>
</tr>
<tr class="slimRowColor0">
<td>GET</td>
<td><div><a href='http://localhost:9876/resources/2'>/resources/2</a></div></td>
<td><span class="pass"><div>200</div></span></td>
<td><div>Set-Cookie&nbsp;:&nbsp;JID="ABC.${a.y}";<br/>Content-Type&nbsp;:&nbsp;application/xml;charset=ISO-8859-1<br/>Content-Length&nbsp;:&nbsp;68<br/>Server&nbsp;:&nbsp;Jetty(6.0.2)</div></td>
<td><span class="pass"><div><br/>&nbsp;/resource/name[text()='Bill']&lt;br/&gt;<br/>&nbsp;/resource/data[text()='Some&nbsp;data&nbsp;on&nbsp;Bill']<br/><br/><i><span class='fit_label'>expected</span></i><hr/><br/>&lt;resource&gt;&lt;name&gt;Bill&lt;/name&gt;&lt;data&gt;Some&nbsp;data&nbsp;on&nbsp;Bill&lt;/data&gt;&lt;/resource&gt;<br/><i><span class='fit_label'>actual</span></i></div></span></td>
</tr>
<tr class="slimRowColor1">
<td>let</td>
<td>name</td>
<td>body</td>
<td><div>/resource/name/text()</div></td>
<td><div>Bill</div></td>
</tr>
</table>
<br/>...or from a JSON body<br/><br/><table>
<tr class="slimRowTitle">
<td><span class="pass">Table: Rest Fixture</span></td>
<td colspan="4"><a href="http://localhost:9876">http://localhost:9876</a></td>
</tr>
<tr class="slimRowColor0">
<td>GET</td>
<td><div><a href='http://localhost:9876/resources/1.json'>/resources/1.json</a></div></td>
<td><span class="pass"><div>200</div></span></td>
<td><span class="pass"><div>Content-Type&nbsp;:&nbsp;application/json<br/><i><span class='fit_label'>expected</span></i><hr/><br/>Set-Cookie&nbsp;:&nbsp;JID="ABC.${a.y}";<br/>Content-Type&nbsp;:&nbsp;application/json;charset=ISO-8859-1<br/>Content-Length&nbsp;:&nbsp;77<br/>Server&nbsp;:&nbsp;Jetty(6.0.2)<br/><i><span class='fit_label'>actual</span></i></div></span></td>
<td><span class="pass"><div><br/>jsonbody.resource.name=='a&nbsp;funky&nbsp;name'&nbsp;&lt;br/&gt;<br/>jsonbody.resource.data=='an&nbsp;important&nbsp;message'<br/>&nbsp;<br/><i><span class='fit_label'>expected</span></i><hr/><br/>{&nbsp;"resource"&nbsp;:&nbsp;{&nbsp;"name"&nbsp;:&nbsp;"a&nbsp;funky&nbsp;name",&nbsp;"data"&nbsp;:&nbsp;"an&nbsp;important&nbsp;message"&nbsp;}&nbsp;}<br/><i><span class='fit_label'>actual</span></i></div></span></td>
</tr>
<tr class="slimRowColor1">
<td>let</td>
<td>name</td>
<td>body</td>
<td><div>/resource/name/text()</div></td>
<td><div>a&nbsp;funky&nbsp;name</div></td>
</tr>
</table>
<br/><div class="collapsible"><ul><li><a href='#' class='expandall'>Expand</a></li><li><a href='#' class='collapseall'>Collapse</a></li></ul>
<p class="title">Note</p>
<div>Label values can be accessed from code using <b>new Variables().get("labelname");</b><br/></div>
</div>
<br/><i>LET resolves names from Fixture Symbol map if not found in the local map</i><br/><br/>LetTestSupport allows to get/set values in the Fixture Symbol map<br/><br/><br/><table>
<tr class="slimRowTitle">
<td>script</td>
<td><span class="pass">smartrics.rest.test.fitnesse.fixture.LetTestSupport</span></td>
</tr>
<tr class="slimRowColor5">
<td>assign</td>
<td>/resources</td>
</tr>
<tr class="slimRowColor5">
<td>$resType&lt;-[/resources]</td>
<td>value</td>
</tr>
</table>
<br/><div class="collapsible"><ul><li><a href='#' class='expandall'>Expand</a></li><li><a href='#' class='collapseall'>Collapse</a></li></ul>
<p class="title">Note</p>
<div>Look at the source code of this page to see that the resource URI<br/>for the GET method below is defined as <b>%resType%/%id%</b><br/></div>
</div>
<br/><table>
<tr class="slimRowTitle">
<td><span class="pass">Table: Rest Fixture</span></td>
<td colspan="4"><a href="http://localhost:9876">http://localhost:9876</a></td>
</tr>
<tr class="slimRowColor0">
<td>GET</td>
<td><div><a href='http://localhost:9876/resources/2'>/resources/2</a></div></td>
<td><span class="pass"><div>200</div></span></td>
<td><div>Set-Cookie&nbsp;:&nbsp;JID="ABC.${a.y}";<br/>Content-Type&nbsp;:&nbsp;application/xml;charset=ISO-8859-1<br/>Content-Length&nbsp;:&nbsp;68<br/>Server&nbsp;:&nbsp;Jetty(6.0.2)</div></td>
<td><div>&lt;resource&gt;&lt;name&gt;Bill&lt;/name&gt;&lt;data&gt;Some&nbsp;data&nbsp;on&nbsp;Bill&lt;/data&gt;&lt;/resource&gt;</div></td>
</tr>
<tr class="slimRowColor1">
<td>let</td>
<td>theName</td>
<td>body</td>
<td><div>/resource/name/text()</div></td>
<td><div>Bill</div></td>
</tr>
</table>
<br/><table>
<tr class="slimRowTitle">
<td>script</td>
<td colspan="2"><span class="pass">smartrics.rest.test.fitnesse.fixture.LetTestSupport</span></td>
</tr>
<tr class="slimRowColor5">
<td>assign</td>
<td colspan="2">$theName</td>
</tr>
<tr class="slimRowColor0">
<td>check</td>
<td>value</td>
<td><span class="pass">Bill</span></td>
</tr>
</table>
<br/>Other fixtures can set a value in the symbol map with <i>Fixture.setSymbol</i>.<br/>The RestFixture<a title="create page" href="RestFixtureTests.RestFixture?edit&amp;nonExistent=true">[?]</a> can then pick them up<br/><br/>This fixture sets <i>symbolName=/resources</i>...<br/><br/><br/><table>
<tr class="slimRowTitle">
<td>script</td>
<td><span class="pass">smartrics.rest.test.fitnesse.fixture.LetTestSupport</span></td>
</tr>
<tr class="slimRowColor5">
<td>assign</td>
<td>/resources</td>
</tr>
<tr class="slimRowColor5">
<td>$aNameOfASymbol&lt;-[/resources]</td>
<td>value</td>
</tr>
</table>
<br/>... then the value is used by the RestFixture<br/><table>
<tr class="slimRowTitle">
<td><span class="pass">Table: Rest Fixture</span></td>
<td colspan="4"><a href="http://localhost:9876">http://localhost:9876</a></td>
</tr>
<tr class="slimRowColor0">
<td>GET</td>
<td><div><a href='http://localhost:9876/resources/2'>/resources/2</a></div></td>
<td><span class="pass"><div>200</div></span></td>
<td><div>Set-Cookie&nbsp;:&nbsp;JID="ABC.${a.y}";<br/>Content-Type&nbsp;:&nbsp;application/xml;charset=ISO-8859-1<br/>Content-Length&nbsp;:&nbsp;68<br/>Server&nbsp;:&nbsp;Jetty(6.0.2)</div></td>
<td><div>&lt;resource&gt;&lt;name&gt;Bill&lt;/name&gt;&lt;data&gt;Some&nbsp;data&nbsp;on&nbsp;Bill&lt;/data&gt;&lt;/resource&gt;</div></td>
</tr>
</table>
<br/></content>
<relativePageName>LetTests</relativePageName>
<instructions>
<instructionResult>
<instruction>{id='scriptTable_0_0', instruction='make', instanceName='scriptTableActor', className='smartrics.rest.test.fitnesse.fixture.HttpServerFixture', args=[]}</instruction>
<slimResult>pass(smartrics.rest.test.fitnesse.fixture.HttpServerFixture)</slimResult>
<expectation>
<status>pass</status>
<instructionId>scriptTable_0_0</instructionId>
<col>1</col>
<row>0</row>
<type>ConstructionExpectation</type>
<evaluationMessage>smartrics.rest.test.fitnesse.fixture.HttpServerFixture</evaluationMessage>
</expectation>
</instructionResult>
<instructionResult>
<instruction>{id='scriptTable_0_1', instruction='call', instanceName='scriptTableActor', methodName='isStarted', args=[]}</instruction>
<slimResult>pass(true)</slimResult>
<expectation>
<status>pass</status>
<instructionId>scriptTable_0_1</instructionId>
<col>2</col>
<row>1</row>
<type>ReturnedValueExpectation</type>
<evaluationMessage>true</evaluationMessage>
</expectation>
</instructionResult>
<instructionResult>
<instruction>{id='scriptTable_0_2', instruction='call', instanceName='scriptTableActor', methodName='resetResourcesDatabase', args=[]}</instruction>
<slimResult>pass()</slimResult>
<expectation>
<status>pass</status>
<instructionId>scriptTable_0_2</instructionId>
<col>0</col>
<row>2</row>
<type>ScriptActionExpectation</type>
</expectation>
</instructionResult>
<instructionResult>
<instruction>{id='tableTable_1_0', instruction='make', instanceName='tableTable_1', className='RestFixture', args=[<a href="http://localhost:9876">http://localhost:9876</a>]}</instruction>
<slimResult>pass(Table: Rest Fixture)</slimResult>
<expectation>
<status>pass</status>
<instructionId>tableTable_1_0</instructionId>
<col>0</col>
<row>0</row>
<type>ConstructionExpectation</type>
<evaluationMessage>Table: Rest Fixture</evaluationMessage>
</expectation>
</instructionResult>
<instructionResult>
<instruction>{id='tableTable_1_1', instruction='call', instanceName='tableTable_1', methodName='doTable', args=[[[setBody, <resource><name>Bill</name><data>Some data on Bill</data></resource>], [POST, /resources/, 201, , no-body], [let, id, header, Location:/resources/(.+), ]]]}</instruction>
<slimResult>pass()</slimResult>
<expectation>
<status>pass</status>
<instructionId>tableTable_1_1</instructionId>
<type>TableTableExpectation</type>
</expectation>
</instructionResult>
<instructionResult>
<instruction>{id='tableTable_2_0', instruction='make', instanceName='tableTable_2', className='RestFixture', args=[<a href="http://localhost:9876">http://localhost:9876</a>]}</instruction>
<slimResult>pass(Table: Rest Fixture)</slimResult>
<expectation>
<status>pass</status>
<instructionId>tableTable_2_0</instructionId>
<col>0</col>
<row>0</row>
<type>ConstructionExpectation</type>
<evaluationMessage>Table: Rest Fixture</evaluationMessage>
</expectation>
</instructionResult>
<instructionResult>
<instruction>{id='tableTable_2_1', instruction='call', instanceName='tableTable_2', methodName='doTable', args=[[[GET, /resources/%id%, 200, ,
/resource/name[text()='Bill']<br/>
/resource/data[text()='Some data on Bill']
], [let, name, body, /resource/name/text(), ]]]}</instruction>
<slimResult>pass()</slimResult>
<expectation>
<status>pass</status>
<instructionId>tableTable_2_1</instructionId>
<type>TableTableExpectation</type>
</expectation>
</instructionResult>
<instructionResult>
<instruction>{id='tableTable_3_0', instruction='make', instanceName='tableTable_3', className='RestFixture', args=[<a href="http://localhost:9876">http://localhost:9876</a>]}</instruction>
<slimResult>pass(Table: Rest Fixture)</slimResult>
<expectation>
<status>pass</status>
<instructionId>tableTable_3_0</instructionId>
<col>0</col>
<row>0</row>
<type>ConstructionExpectation</type>
<evaluationMessage>Table: Rest Fixture</evaluationMessage>
</expectation>
</instructionResult>
<instructionResult>
<instruction>{id='tableTable_3_1', instruction='call', instanceName='tableTable_3', methodName='doTable', args=[[[GET, /resources/1.json, 200, Content-Type : application/json,
jsonbody.resource.name=='a funky name' <br/>
jsonbody.resource.data=='an important message'
], [let, name, body, /resource/name/text(), ]]]}</instruction>
<slimResult>pass()</slimResult>
<expectation>
<status>pass</status>
<instructionId>tableTable_3_1</instructionId>
<type>TableTableExpectation</type>
</expectation>
</instructionResult>
<instructionResult>
<instruction>{id='scriptTable_4_0', instruction='make', instanceName='scriptTableActor', className='smartrics.rest.test.fitnesse.fixture.LetTestSupport', args=[]}</instruction>
<slimResult>pass(smartrics.rest.test.fitnesse.fixture.LetTestSupport)</slimResult>
<expectation>
<status>pass</status>
<instructionId>scriptTable_4_0</instructionId>
<col>1</col>
<row>0</row>
<type>ConstructionExpectation</type>
<evaluationMessage>smartrics.rest.test.fitnesse.fixture.LetTestSupport</evaluationMessage>
</expectation>
</instructionResult>
<instructionResult>
<instruction>{id='scriptTable_4_1', instruction='call', instanceName='scriptTableActor', methodName='assign', args=[/resources]}</instruction>
<slimResult></slimResult>
<expectation>
<instructionId>scriptTable_4_1</instructionId>
<col>0</col>
<row>1</row>
<type>ScriptActionExpectation</type>
</expectation>
</instructionResult>
<instructionResult>
<instruction>{id='scriptTable_4_2', instruction='callAndAssign', symbolName='resType', instanceName='scriptTableActor', methodName='value', args=[]}</instruction>
<slimResult>$resType<-[/resources]</slimResult>
<expectation>
<instructionId>scriptTable_4_2</instructionId>
<col>0</col>
<row>2</row>
<type>SymbolAssignmentExpectation</type>
<evaluationMessage>$resType<-[/resources]</evaluationMessage>
</expectation>
</instructionResult>
<instructionResult>
<instruction>{id='tableTable_5_0', instruction='make', instanceName='tableTable_5', className='RestFixture', args=[<a href="http://localhost:9876">http://localhost:9876</a>]}</instruction>
<slimResult>pass(Table: Rest Fixture)</slimResult>
<expectation>
<status>pass</status>
<instructionId>tableTable_5_0</instructionId>
<col>0</col>
<row>0</row>
<type>ConstructionExpectation</type>
<evaluationMessage>Table: Rest Fixture</evaluationMessage>
</expectation>
</instructionResult>
<instructionResult>
<instruction>{id='tableTable_5_1', instruction='call', instanceName='tableTable_5', methodName='doTable', args=[[[GET, %resType%/%id%, 200, , ], [let, theName, body, /resource/name/text(), ]]]}</instruction>
<slimResult>pass()</slimResult>
<expectation>
<status>pass</status>
<instructionId>tableTable_5_1</instructionId>
<type>TableTableExpectation</type>
</expectation>
</instructionResult>
<instructionResult>
<instruction>{id='scriptTable_6_0', instruction='make', instanceName='scriptTableActor', className='smartrics.rest.test.fitnesse.fixture.LetTestSupport', args=[]}</instruction>
<slimResult>pass(smartrics.rest.test.fitnesse.fixture.LetTestSupport)</slimResult>
<expectation>
<status>pass</status>
<instructionId>scriptTable_6_0</instructionId>
<col>1</col>
<row>0</row>
<type>ConstructionExpectation</type>
<evaluationMessage>smartrics.rest.test.fitnesse.fixture.LetTestSupport</evaluationMessage>
</expectation>
</instructionResult>
<instructionResult>
<instruction>{id='scriptTable_6_1', instruction='call', instanceName='scriptTableActor', methodName='assign', args=[$theName]}</instruction>
<slimResult></slimResult>
<expectation>
<instructionId>scriptTable_6_1</instructionId>
<col>0</col>
<row>1</row>
<type>ScriptActionExpectation</type>
</expectation>
</instructionResult>
<instructionResult>
<instruction>{id='scriptTable_6_2', instruction='call', instanceName='scriptTableActor', methodName='value', args=[]}</instruction>
<slimResult>pass(Bill)</slimResult>
<expectation>
<status>pass</status>
<instructionId>scriptTable_6_2</instructionId>
<col>2</col>
<row>2</row>
<type>ReturnedValueExpectation</type>
<evaluationMessage>Bill</evaluationMessage>
</expectation>
</instructionResult>
<instructionResult>
<instruction>{id='scriptTable_7_0', instruction='make', instanceName='scriptTableActor', className='smartrics.rest.test.fitnesse.fixture.LetTestSupport', args=[]}</instruction>
<slimResult>pass(smartrics.rest.test.fitnesse.fixture.LetTestSupport)</slimResult>
<expectation>
<status>pass</status>
<instructionId>scriptTable_7_0</instructionId>
<col>1</col>
<row>0</row>
<type>ConstructionExpectation</type>
<evaluationMessage>smartrics.rest.test.fitnesse.fixture.LetTestSupport</evaluationMessage>
</expectation>
</instructionResult>
<instructionResult>
<instruction>{id='scriptTable_7_1', instruction='call', instanceName='scriptTableActor', methodName='assign', args=[/resources]}</instruction>
<slimResult></slimResult>
<expectation>
<instructionId>scriptTable_7_1</instructionId>
<col>0</col>
<row>1</row>
<type>ScriptActionExpectation</type>
</expectation>
</instructionResult>
<instructionResult>
<instruction>{id='scriptTable_7_2', instruction='callAndAssign', symbolName='aNameOfASymbol', instanceName='scriptTableActor', methodName='value', args=[]}</instruction>
<slimResult>$aNameOfASymbol<-[/resources]</slimResult>
<expectation>
<instructionId>scriptTable_7_2</instructionId>
<col>0</col>
<row>2</row>
<type>SymbolAssignmentExpectation</type>
<evaluationMessage>$aNameOfASymbol<-[/resources]</evaluationMessage>
</expectation>
</instructionResult>
<instructionResult>
<instruction>{id='tableTable_8_0', instruction='make', instanceName='tableTable_8', className='RestFixture', args=[<a href="http://localhost:9876">http://localhost:9876</a>]}</instruction>
<slimResult>pass(Table: Rest Fixture)</slimResult>
<expectation>
<status>pass</status>
<instructionId>tableTable_8_0</instructionId>
<col>0</col>
<row>0</row>
<type>ConstructionExpectation</type>
<evaluationMessage>Table: Rest Fixture</evaluationMessage>
</expectation>
</instructionResult>
<instructionResult>
<instruction>{id='tableTable_8_1', instruction='call', instanceName='tableTable_8', methodName='doTable', args=[[[GET, %aNameOfASymbol%/%id%, 200, , ]]]}</instruction>
<slimResult>pass()</slimResult>
<expectation>
<status>pass</status>
<instructionId>tableTable_8_1</instructionId>
<type>TableTableExpectation</type>
</expectation>
</instructionResult>
</instructions>
</result>
<executionLog>
<testSystem></testSystem>
<command></command>
<exitCode>0</exitCode>
<stdOut>displayAbsoluteURLInFull: 'true', cellText: '/resources/', resolvedUrl: '/resources/', parsed: '/resources/', actualText: '/resources/'
displayAbsoluteURLInFull: 'true', cellText: '/resources/%id%', resolvedUrl: '/resources/2', parsed: '/resources/2', actualText: '/resources/2'
displayAbsoluteURLInFull: 'true', cellText: '/resources/1.json', resolvedUrl: '/resources/1.json', parsed: '/resources/1.json', actualText: '/resources/1.json'
displayAbsoluteURLInFull: 'true', cellText: '%resType%/%id%', resolvedUrl: '/resources/2', parsed: '/resources/2', actualText: '/resources/2'
displayAbsoluteURLInFull: 'true', cellText: '%aNameOfASymbol%/%id%', resolvedUrl: '/resources/2', parsed: '/resources/2', actualText: '/resources/2'
</stdOut> <stdErr></stdErr> </executionLog>
<finalCounts>
<right>1</right>
<wrong>0</wrong>
<ignores>0</ignores>
<exceptions>0</exceptions>
</finalCounts>
<totalRunTimeInMillis>249</totalRunTimeInMillis>
</testResults>