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.JavascriptExpectations.20160316114558_2_0_0_1.xml Maven / Gradle / Ivy
<?xml version="1.0"?>
<testResults>
<FitNesseVersion>v20150424</FitNesseVersion>
<rootPath>RestFixtureTests.JavascriptExpectations</rootPath>
<result>
<counts>
<right>14</right>
<wrong>0</wrong>
<ignores>0</ignores>
<exceptions>0</exceptions>
</counts>
<runTimeInMillis>424</runTimeInMillis>
<content></content>
<relativePageName>SuiteSetUp</relativePageName>
<instructions>
<instructionResult>
<instruction>{id='import_0_0', instruction='import', path='smartrics.rest.fitnesse.fixture'}</instruction>
<slimResult>pass(smartrics.rest.fitnesse.fixture)</slimResult>
<expectation>
<status>pass</status>
<instructionId>import_0_0</instructionId>
<col>0</col>
<row>1</row>
<type>ImportExpectation</type>
<evaluationMessage>smartrics.rest.fitnesse.fixture</evaluationMessage>
</expectation>
</instructionResult>
<instructionResult>
<instruction>{id='import_0_1', instruction='import', path='smartrics.rest.test.fitnesse.fixture'}</instruction>
<slimResult>pass(smartrics.rest.test.fitnesse.fixture)</slimResult>
<expectation>
<status>pass</status>
<instructionId>import_0_1</instructionId>
<col>0</col>
<row>2</row>
<type>ImportExpectation</type>
<evaluationMessage>smartrics.rest.test.fitnesse.fixture</evaluationMessage>
</expectation>
</instructionResult>
<instructionResult>
<instruction>{id='scriptTable_1_0', instruction='make', instanceName='scriptTableActor', className='HttpServerFixture', args=[]}</instruction>
<slimResult>pass(Http Server Fixture)</slimResult>
<expectation>
<status>pass</status>
<instructionId>scriptTable_1_0</instructionId>
<col>1</col>
<row>0</row>
<type>ConstructionExpectation</type>
<evaluationMessage>Http Server Fixture</evaluationMessage>
</expectation>
</instructionResult>
<instructionResult>
<instruction>{id='scriptTable_1_1', instruction='call', instanceName='scriptTableActor', methodName='isStarted', args=[]}</instruction>
<slimResult>pass(false)</slimResult>
<expectation>
<status>pass</status>
<instructionId>scriptTable_1_1</instructionId>
<col>2</col>
<row>1</row>
<type>ReturnedValueExpectation</type>
<evaluationMessage>false</evaluationMessage>
</expectation>
</instructionResult>
<instructionResult>
<instruction>{id='scriptTable_1_2', instruction='call', instanceName='scriptTableActor', methodName='startServer', args=[9876]}</instruction>
<slimResult></slimResult>
<expectation>
<instructionId>scriptTable_1_2</instructionId>
<col>0</col>
<row>2</row>
<type>ScriptActionExpectation</type>
</expectation>
</instructionResult>
<instructionResult>
<instruction>{id='scriptTable_1_3', instruction='call', instanceName='scriptTableActor', methodName='isStarted', args=[]}</instruction>
<slimResult>pass(true)</slimResult>
<expectation>
<status>pass</status>
<instructionId>scriptTable_1_3</instructionId>
<col>2</col>
<row>3</row>
<type>ReturnedValueExpectation</type>
<evaluationMessage>true</evaluationMessage>
</expectation>
</instructionResult>
<instructionResult>
<instruction>{id='tableTable_2_0', instruction='make', instanceName='tableTable_2', className='RestFixtureConfig', args=[]}</instruction>
<slimResult>pass(Table: Rest Fixture Config)</slimResult>
<expectation>
<status>pass</status>
<instructionId>tableTable_2_0</instructionId>
<col>0</col>
<row>0</row>
<type>ConstructionExpectation</type>
<evaluationMessage>Table: Rest Fixture Config</evaluationMessage>
</expectation>
</instructionResult>
<instructionResult>
<instruction>{id='tableTable_2_1', instruction='call', instanceName='tableTable_2', methodName='doTable', args=[[[http.basicauth.username, foo], [http.basicauth.password, bar], [http.client.connection.timeout, 5000], [http.client.use.new.http.uri.factory, false], [restfixture.display.absolute.url.in.full, true], [restfixture.display.actual.on.right, true], [restfixture.display.toggle.for.cells.larger.than, 200], [restfixture.default.headers, defHeader : 1
anotherDefHeader : 2
], [restfixture.xml.namespace.context, ns1alias=http://smartrics/ns1
defalias=http://smartrics/defns], [restfixture.content.default.charset, UTF-8], [restfixture.content.handlers.map, application/xml=XML
application/json=JSON
text/plain=TEXT
default=XML
application/x-javascript=JS
]]]}</instruction>
<slimResult>pass()</slimResult>
<expectation>
<status>pass</status>
<instructionId>tableTable_2_1</instructionId>
<type>TableTableExpectation</type>
</expectation>
</instructionResult>
</instructions>
</result>
<result>
<counts>
<right>26</right>
<wrong>0</wrong>
<ignores>0</ignores>
<exceptions>2</exceptions>
</counts>
<runTimeInMillis>621</runTimeInMillis>
<content></content>
<relativePageName>JavascriptExpectations</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" : "test post", "data" : "some data" } } ], [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%.json, 200, Content-Type : application/json,
jsonbody.resource.name=="test post" && jsonbody.resource.data=="some data"
]]]}</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/%id%.json, 200, Content-Type : application/json,
jsonbody.resource.name.length >= 0
jsonbody.resource.name.length < 1000
jsonbody.resource.name.length < jsonbody.resource.name.length+1
], [let, content, js, response.body, ]]]}</instruction>
<slimResult>pass()</slimResult>
<expectation>
<status>pass</status>
<instructionId>tableTable_3_1</instructionId>
<type>TableTableExpectation</type>
</expectation>
</instructionResult>
<instructionResult>
<instruction>{id='tableTable_4_0', instruction='make', instanceName='tableTable_4', 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_4_0</instructionId>
<col>0</col>
<row>0</row>
<type>ConstructionExpectation</type>
<evaluationMessage>Table: Rest Fixture</evaluationMessage>
</expectation>
</instructionResult>
<instructionResult>
<instruction>{id='tableTable_4_1', instruction='call', instanceName='tableTable_4', methodName='doTable', args=[[[setBody, %content%], [POST, /resources/, 201, , no-body], [let, id, header, Location:/resources/(.+), ]]]}</instruction>
<slimResult>pass()</slimResult>
<expectation>
<status>pass</status>
<instructionId>tableTable_4_1</instructionId>
<type>TableTableExpectation</type>
</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, /resources/%id%.json, 200, Content-Type : application/json, <pre>
/* javascript */
var concat = jsonbody.resource.name + " and " + jsonbody.resource.data
concat=="test post and some data"
</pre>], [let, content, js, response.body, ]]]}</instruction>
<slimResult>pass()</slimResult>
<expectation>
<status>pass</status>
<instructionId>tableTable_5_1</instructionId>
<type>TableTableExpectation</type>
</expectation>
</instructionResult>
<instructionResult>
<instruction>{id='tableTable_6_0', instruction='make', instanceName='tableTable_6', className='RestFixtureConfig', args=[imp]}</instruction>
<slimResult>pass(Table: Rest Fixture Config)</slimResult>
<expectation>
<status>pass</status>
<instructionId>tableTable_6_0</instructionId>
<col>0</col>
<row>0</row>
<type>ConstructionExpectation</type>
<evaluationMessage>Table: Rest Fixture Config</evaluationMessage>
</expectation>
</instructionResult>
<instructionResult>
<instruction>{id='tableTable_6_1', instruction='call', instanceName='tableTable_6', methodName='doTable', args=[[[restfixture.javascript.imports.map, jsonpath=src/main/resources/FitNesseRoot/files/javascript/jsonpath-0.8.0.js]]]}</instruction>
<slimResult>pass()</slimResult>
<expectation>
<status>pass</status>
<instructionId>tableTable_6_1</instructionId>
<type>TableTableExpectation</type>
</expectation>
</instructionResult>
<instructionResult>
<instruction>{id='tableTable_7_0', instruction='make', instanceName='tableTable_7', className='RestFixture', args=[<a href="http://localhost:9876">http://localhost:9876</a>, imp]}</instruction>
<slimResult>pass(Table: Rest Fixture)</slimResult>
<expectation>
<status>pass</status>
<instructionId>tableTable_7_0</instructionId>
<col>0</col>
<row>0</row>
<type>ConstructionExpectation</type>
<evaluationMessage>Table: Rest Fixture</evaluationMessage>
</expectation>
</instructionResult>
<instructionResult>
<instruction>{id='tableTable_7_1', instruction='call', instanceName='tableTable_7', methodName='doTable', args=[[[GET, /resources/%id%.json, 200, Content-Type : application/json, JSONPath.eval(jsonbody, "$..resource.name") == "test post"], [let, name, js,
NativeArray arr = (NativeArray) JSONPath.eval(response.body, "$..resource.name", {resultType:"VALUE"});
var array = "";
for (Object o : arr.getIds()) {
int index = (Integer) o;
array += arr.get(index, null);
array +=", "
}
array;
, ]]]}</instruction>
<slimResult>error()</slimResult>
<expectation>
<status>error</status>
<instructionId>tableTable_7_1</instructionId>
<type>TableTableExpectation</type>
</expectation>
</instructionResult>
</instructions>
</result>
<result>
<counts>
<right>2</right>
<wrong>0</wrong>
<ignores>0</ignores>
<exceptions>0</exceptions>
</counts>
<runTimeInMillis>112</runTimeInMillis>
<content><br/><span class="meta">variable defined: ns1=!-http://smartrics/ns1-!</span>
<br/><span class="meta">variable defined: defns=!-http://smartrics/defns-!</span>
<br/><br/><table>
<tr class="slimRowTitle">
<td>Import</td>
</tr>
<tr class="slimRowColor0">
<td><span class="pass">smartrics.rest.fitnesse.fixture</span></td>
</tr>
<tr class="slimRowColor1">
<td><span class="pass">smartrics.rest.test.fitnesse.fixture</span></td>
</tr>
</table>
<br/><table>
<tr class="slimRowTitle">
<td>script</td>
<td colspan="2"><span class="pass">Http Server Fixture</span></td>
</tr>
<tr class="slimRowColor0">
<td>check</td>
<td>is started</td>
<td><span class="pass">false</span></td>
</tr>
<tr class="slimRowColor3">
<td>start server</td>
<td colspan="2">9876</td>
</tr>
<tr class="slimRowColor0">
<td>check</td>
<td>is started</td>
<td><span class="pass">true</span></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">Configure the <a href="RestFixture">.RestFixture</a> with named configuration table of key value pairs</p>
<div>Read more about .RestFixtureConfig<a title="create page" href="RestFixtureConfig?edit&amp;nonExistent=true">[?]</a><br/></div>
</div>
<table>
<tr class="slimRowTitle">
<td colspan="2"><span class="pass">Table: Rest Fixture Config</span></td>
</tr>
<tr class="slimRowColor0">
<td>http.basicauth.username</td>
<td><span class="pass">foo</span></td>
</tr>
<tr class="slimRowColor1">
<td>http.basicauth.password</td>
<td><span class="pass">bar</span></td>
</tr>
<tr class="slimRowColor0">
<td>http.client.connection.timeout</td>
<td><span class="pass">5000</span></td>
</tr>
<tr class="slimRowColor1">
<td>http.client.use.new.http.uri.factory</td>
<td><span class="pass">false</span></td>
</tr>
<tr class="slimRowColor0">
<td>restfixture.display.absolute.url.in.full</td>
<td><span class="pass">true</span></td>
</tr>
<tr class="slimRowColor1">
<td>restfixture.display.actual.on.right</td>
<td><span class="pass">true</span></td>
</tr>
<tr class="slimRowColor0">
<td>restfixture.display.toggle.for.cells.larger.than</td>
<td><span class="pass">200</span></td>
</tr>
<tr class="slimRowColor1">
<td>restfixture.default.headers</td>
<td><span class="pass">defHeader&amp;nbsp;:&amp;nbsp;1&lt;br/&gt;anotherDefHeader&amp;nbsp;:&amp;nbsp;2&lt;br/&gt;</span></td>
</tr>
<tr class="slimRowColor0">
<td>restfixture.xml.namespace.context</td>
<td><span class="pass">ns1alias=http://smartrics/ns1&amp;nbsp;&lt;br/&gt;&amp;nbsp;defalias=http://smartrics/defns</span></td>
</tr>
<tr class="slimRowColor1">
<td>restfixture.content.default.charset</td>
<td><span class="pass">UTF-8</span></td>
</tr>
<tr class="slimRowColor0">
<td>restfixture.content.handlers.map</td>
<td><span class="pass">application/xml=XML&lt;br/&gt;application/json=JSON&lt;br/&gt;text/plain=TEXT&lt;br/&gt;default=XML&lt;br/&gt;application/x-javascript=JS&lt;br/&gt;</span></td>
</tr>
</table>
<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/><h3>Expectations in Javascript on responses with content type application/json</h3>
<br/>As of <a href="RestFixture">.RestFixture</a>. Version 2, a javascript engine is embedded to allow expectations in Javascript on response body contents in JSON format.<br/><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">XPaths and JSON</p>
<div>For backward compatibility XPath expressions are maintained and executed<br/></div>
</div>
<br/>After a successful response is received with content type "application/json" the expectation cell in a <a href="RestFixture">.RestFixture</a> row is<br/>interpreted as a string with Javascript and executed within the context of the response 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>setBody</td>
<td colspan="4"> { "resource" : { "name" : "test post", "data" : "some data" } } </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/>A variable &lt;code&gt;jsonbody&lt;/code&gt; is defined holding the JSON in the response.<br/><br/>The test passes if the result of the evaluation of the cell is a boolean.<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.json'>/resources/2.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;65<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=="test&nbsp;post"&nbsp;&&&nbsp;jsonbody.resource.data=="some&nbsp;data"<br/><br/><i><span class='fit_label'>expected</span></i><hr/><br/>&nbsp;{&nbsp;"resource"&nbsp;:&nbsp;{&nbsp;"name"&nbsp;:&nbsp;"test&nbsp;post",&nbsp;"data"&nbsp;:&nbsp;"some&nbsp;data"&nbsp;}&nbsp;}&nbsp;<br/><i><span class='fit_label'>actual</span></i></div></span></td>
</tr>
</table>
<br/>It is possible to specify multiple assertions, one for each line.<br/>The test passes if each line evaluates to true.<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.json'>/resources/2.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;65<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.length&nbsp;&gt;=&nbsp;0<br/>jsonbody.resource.name.length&nbsp;&lt;&nbsp;1000<br/>jsonbody.resource.name.length&nbsp;&lt;&nbsp;jsonbody.resource.name.length+1<br/><br/><i><span class='fit_label'>expected</span></i><hr/><br/>&nbsp;{&nbsp;"resource"&nbsp;:&nbsp;{&nbsp;"name"&nbsp;:&nbsp;"test&nbsp;post",&nbsp;"data"&nbsp;:&nbsp;"some&nbsp;data"&nbsp;}&nbsp;}&nbsp;<br/><i><span class='fit_label'>actual</span></i></div></span></td>
</tr>
<tr class="slimRowColor1">
<td>let</td>
<td>content</td>
<td>js</td>
<td><div>response.body</div></td>
<td><div>&nbsp;{&nbsp;"resource"&nbsp;:&nbsp;{&nbsp;"name"&nbsp;:&nbsp;"test&nbsp;post",&nbsp;"data"&nbsp;:&nbsp;"some&nbsp;data"&nbsp;}&nbsp;}&nbsp;</div></td>
</tr>
</table>
<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"><span class="pass"><div>&nbsp;{&nbsp;"resource"&nbsp;:&nbsp;{&nbsp;"name"&nbsp;:&nbsp;"test&nbsp;post",&nbsp;"data"&nbsp;:&nbsp;"some&nbsp;data"&nbsp;}&nbsp;}&nbsp;</div></span></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/3<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>3</div></td>
</tr>
</table>
<br/>In some cases may be useful to force evaluation of the expectation cell as a javascript block.<br/>By embedding the &lt;code&gt;/* javascript */&lt;/code&gt; comment, the whole expectation cell will be parsed and evaluated entirely using the javascript interpreter.<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/3.json'>/resources/3.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;65<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/>/*&nbsp;javascript&nbsp;*/<br/>var&nbsp;concat&nbsp;=&nbsp;jsonbody.resource.name&nbsp;+&nbsp;"&nbsp;and&nbsp;"&nbsp;+&nbsp;jsonbody.resource.data<br/>concat=="test&nbsp;post&nbsp;and&nbsp;some&nbsp;data"<br/><br/><i><span class='fit_label'>expected</span></i><hr/><br/>&nbsp;{&nbsp;"resource"&nbsp;:&nbsp;{&nbsp;"name"&nbsp;:&nbsp;"test&nbsp;post",&nbsp;"data"&nbsp;:&nbsp;"some&nbsp;data"&nbsp;}&nbsp;}&nbsp;<br/><i><span class='fit_label'>actual</span></i></div></span></td>
</tr>
<tr class="slimRowColor1">
<td>let</td>
<td>content</td>
<td>js</td>
<td><div>response.body</div></td>
<td><div>&nbsp;{&nbsp;"resource"&nbsp;:&nbsp;{&nbsp;"name"&nbsp;:&nbsp;"test&nbsp;post",&nbsp;"data"&nbsp;:&nbsp;"some&nbsp;data"&nbsp;}&nbsp;}&nbsp;</div></td>
</tr>
</table>
<br/>It is possible to inject external javascript scripts by setting the "restfixture.javascript.imports.map" property to a map value (script name=script path).<br/>The path to the script can be to a file in the filesystem or to an racheable URL<br/><br/><table>
<tr class="slimRowTitle">
<td><span class="pass">Table: Rest Fixture Config</span></td>
<td>imp</td>
</tr>
<tr class="slimRowColor0">
<td>restfixture.javascript.imports.map</td>
<td><span class="pass">jsonpath=src/main/resources/FitNesseRoot/files/javascript/jsonpath-0.8.0.js</span></td>
</tr>
</table>
<br/><table>
<tr class="slimRowTitle">
<td><span class="pass">Table: Rest Fixture</span></td>
<td><a href="http://localhost:9876">http://localhost:9876</a></td>
<td colspan="3">imp</td>
</tr>
<tr class="slimRowColor0">
<td>GET</td>
<td><div><a href='http://localhost:9876/resources/3.json'>/resources/3.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;65<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>JSONPath.eval(jsonbody,&nbsp;"$..resource.name")&nbsp;==&nbsp;"test&nbsp;post"<br/><i><span class='fit_label'>expected</span></i><hr/><br/>&nbsp;{&nbsp;"resource"&nbsp;:&nbsp;{&nbsp;"name"&nbsp;:&nbsp;"test&nbsp;post",&nbsp;"data"&nbsp;:&nbsp;"some&nbsp;data"&nbsp;}&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>js</td>
<td>
NativeArray arr = (NativeArray) JSONPath.eval(response.body, "$..resource.name", {resultType:"VALUE"});
var array = "";
for (Object o : arr.getIds()) {
int index = (Integer) o;
array += arr.get(index, null);
array +=", "
}
array;
<span class="error"><div>missing ; before statement (unnamed script#2)</div></span></td>
<td></td>
</tr>
</table>
<br/><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">stop server</td>
</tr>
<tr class="slimRowColor0">
<td>check</td>
<td>is stopped</td>
<td><span class="pass">true</span></td>
</tr>
</table>
</content>
<relativePageName>SuiteTearDown</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='stopServer', args=[]}</instruction>
<slimResult></slimResult>
<expectation>
<instructionId>scriptTable_0_2</instructionId>
<col>0</col>
<row>2</row>
<type>ScriptActionExpectation</type>
</expectation>
</instructionResult>
<instructionResult>
<instruction>{id='scriptTable_0_3', instruction='call', instanceName='scriptTableActor', methodName='isStopped', args=[]}</instruction>
<slimResult>pass(true)</slimResult>
<expectation>
<status>pass</status>
<instructionId>scriptTable_0_3</instructionId>
<col>2</col>
<row>3</row>
<type>ReturnedValueExpectation</type>
<evaluationMessage>true</evaluationMessage>
</expectation>
</instructionResult>
</instructions>
</result>
<executionLog>
<testSystem>slim:fitnesse.slim.SlimService</testSystem>
<command>c:\Progra~1\Java\jdk1.7.0_71\bin\java -cp C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\fitnesse-20150424.jar;target/classes/;target/test-classes/;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\ant-1.7.0.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\ant-launcher-1.7.0.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\commons-codec-1.2.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\commons-collections-3.2.1.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\commons-httpclient-3.1.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\commons-lang-2.6.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\commons-logging-1.0.4.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\cos-05Nov2002.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\diffutils-1.3.0.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\fitnesse-20150424.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\hamcrest-all-1.3.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\hamcrest-core-1.1.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\htmlcleaner-2.2.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\htmllexer-2.1.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\htmlparser-2.1.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\httpclient-4.1.3.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\httpcore-4.1.4.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\JavaEWAH-0.7.9.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\jdom-1.1.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\jettison-1.3.2.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\jetty-6.0.2.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\jetty-util-6.0.2.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\jsch-0.1.50.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\json-20140107.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\junit-4.10.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\log4j-1.2.17.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\mockito-all-1.9.0.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\org.eclipse.jgit-3.6.2.201501210735-r.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\rhino-1.7R3.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\servlet-api-2.5-6.0.2.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\slf4j-api-1.6.6.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\slf4j-log4j12-1.6.6.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\smartrics-RestClient-2.1.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\smartrics-RestFixture-4.1.6.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\stax-api-1.0.1.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\velocity-1.7.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\xmlpull-1.1.3.1.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\xpp3_min-1.1.4c.jar;C:\Users\702161900\Dev\smartrics\RestFixtureLiveDoc\target\dependencies\xstream-1.4.2.jar fitnesse.slim.SlimService 8091</command>
<exitCode>0</exitCode>
<stdOut>11:46:00,298 ERROR [RestFixture] - Exception occurred when processing cell=smartrics.rest.fitnesse.fixture.SlimCell@1433150a
smartrics.rest.fitnesse.fixture.support.JavascriptException: missing ; before statement (unnamed script#2)
at smartrics.rest.fitnesse.fixture.support.JavascriptWrapper.evaluateExpression(JavascriptWrapper.java:136)
at smartrics.rest.fitnesse.fixture.support.JavascriptWrapper.evaluateExpression(JavascriptWrapper.java:83)
at smartrics.rest.fitnesse.fixture.support.LetBodyJsHandler.handle(LetBodyJsHandler.java:50)
at smartrics.rest.fitnesse.fixture.RestFixture.let(RestFixture.java:821)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at smartrics.rest.fitnesse.fixture.RestFixture.processRow(RestFixture.java:914)
at smartrics.rest.fitnesse.fixture.RestFixture.processSlimRow(RestFixture.java:1250)
at smartrics.rest.fitnesse.fixture.RestFixture.doTable(RestFixture.java:420)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at fitnesse.slim.fixtureInteraction.DefaultInteraction.methodInvoke(DefaultInteraction.java:80)
at fitnesse.slim.MethodExecutor.callMethod(MethodExecutor.java:44)
at fitnesse.slim.MethodExecutor.invokeMethod(MethodExecutor.java:31)
at fitnesse.slim.MethodExecutor.findAndInvoke(MethodExecutor.java:57)
at fitnesse.slim.FixtureMethodExecutor.execute(FixtureMethodExecutor.java:20)
at fitnesse.slim.StatementExecutor.getMethodExecutionResult(StatementExecutor.java:126)
at fitnesse.slim.StatementExecutor.call(StatementExecutor.java:104)
at fitnesse.slim.instructions.CallInstruction.executeInternal(CallInstruction.java:35)
at fitnesse.slim.instructions.Instruction.execute(Instruction.java:29)
at fitnesse.slim.ListExecutor$Executive.executeStatement(ListExecutor.java:49)
at fitnesse.slim.ListExecutor$Executive.executeStatements(ListExecutor.java:43)
at fitnesse.slim.ListExecutor.execute(ListExecutor.java:83)
at fitnesse.slim.SlimServer.executeInstructions(SlimServer.java:84)
at fitnesse.slim.SlimServer.processOneSetOfInstructions(SlimServer.java:77)
at fitnesse.slim.SlimServer.tryProcessInstructions(SlimServer.java:56)
at fitnesse.slim.SlimServer.serve(SlimServer.java:42)
at fitnesse.slim.SlimService.handle(SlimService.java:186)
at fitnesse.slim.SlimService.acceptOne(SlimService.java:194)
at fitnesse.slim.SlimService.accept(SlimService.java:156)
at fitnesse.slim.SlimService.startWithFactory(SlimService.java:77)
at fitnesse.slim.SlimService.main(SlimService.java:57)
</stdOut> <stdErr></stdErr> </executionLog>
<finalCounts>
<right>2</right>
<wrong>0</wrong>
<ignores>0</ignores>
<exceptions>1</exceptions>
</finalCounts>
<totalRunTimeInMillis>2706</totalRunTimeInMillis>
</testResults>