![JAR search and dependency download from the Maven repository](/logo.png)
FitNesseRoot.files.testResults.RestFixtureTests.LetTestsV2.20160309221200_1_0_0_0.xml Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of smartrics-RestFixture-LiveDoc Show documentation
Show all versions of smartrics-RestFixture-LiveDoc Show documentation
FitNesse tests documenting the RestFixture
<?xml version="1.0"?> <testResults> <FitNesseVersion>v20150424</FitNesseVersion> <rootPath>RestFixtureTests.LetTestsV2</rootPath> <result> <counts> <right>20</right> <wrong>0</wrong> <ignores>0</ignores> <exceptions>0</exceptions> </counts> <runTimeInMillis>124</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/>LET can use now the full power of JavaScript to extract data from the last response parts. The additions<br/>to support the new JavaScript extensions will not break the existing RestFixture API.<br/><br/>The JavaScript extensions can be used to process more effectively JSON <i>Content-Type</i>s.<br/><br/><i>LET can access the Fitnesse Symbols map to extract data previously stored</i><br/><br/>If the context of the let context is <i>js</i> the expression is evaluated as a javascript string. The value assigned<br/>to the let label is the result of the evaluation of the content in the expression cell.<br/><br/>For example:<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>let</td> <td>message</td> <td>js</td> <td><div>'Hello,&nbsp;World!'</div></td> <td><span class="pass"><div>Hello,&nbsp;World!</div></span></td> </tr> <tr class="slimRowColor1"> <td>let</td> <td>sum</td> <td>js</td> <td><div>'2&nbsp;+&nbsp;5&nbsp;=&nbsp;'&nbsp;+&nbsp;(2&nbsp;+&nbsp;5)</div></td> <td><span class="pass"><div>2&nbsp;+&nbsp;5&nbsp;=&nbsp;7</div></span></td> </tr> <tr class="slimRowColor0"> <td>let</td> <td>two_expressions</td> <td>js</td> <td><div>a=1;<br/>'a&nbsp;is&nbsp;'&nbsp;+&nbsp;a</div></td> <td><span class="pass"><div>a&nbsp;is&nbsp;1</div></span></td> </tr> <tr class="slimRowColor1"> <td>let</td> <td>json_expr</td> <td>js</td> <td><div><br/>json&nbsp;=&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;"widget":&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"debug":&nbsp;"on",<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"window":&nbsp;{<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"title":&nbsp;"Sample&nbsp;Konfabulator&nbsp;Widget",<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"name":&nbsp;"main_window",<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"width":&nbsp;500,<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"height":&nbsp;500<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n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bsp;&nbsp;"hOffset":&nbsp;250,<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"vOffset":&nbsp;100,<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"alignment":&nbsp;"center",<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"onMouseUp":&nbsp;"sun1.opacity&nbsp;=&nbsp;(sun1.opacity&nbsp;/&nbsp;100)&nbsp;*&nbsp;90;"<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br/>&nbsp;&nbsp;&nbsp;&nbsp;}<br/>};<br/>json.widget.image.src<br/></div></td> <td><span class="pass"><div>Images/Sun.png</div></span></td> </tr> </table> <br/>(Example courtesy of <a href="http://json.org/example.html)">http://json.org/example.html)</a><br/><br/>It's also possible to access the FitNesse symbols map. The scope where expression is evaluated contains the <br/>'symbols' object <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> <tr class="slimRowColor1"> <td>let</td> <td>id_string</td> <td>js</td> <td><div>'The&nbsp;id&nbsp;is:&nbsp;'&nbsp;+&nbsp;symbols.get('id')</div></td> <td><span class="pass"><div>The&nbsp;id&nbsp;is:&nbsp;2</div></span></td> </tr> </table> <br/><br/>The scope also contains the 'response' object, populated with the data from the last Rest response executed<br/><br/>For example<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'>/resources/1</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;77<br/>Server&nbsp;:&nbsp;Jetty(6.0.2)</div></td> <td><div>{&nbsp;"resource"&nbsp;:&nbsp;{&nbsp;"name"&nbsp;:&nbsp;"a&nbsp;funky&nbsp;name",&nbsp;"data"&nbsp;:&nbsp;"an&nbsp;important&nbsp;message"&nbsp;}&nbsp;}</div></td> </tr> <tr class="slimRowColor1"> <td>let</td> <td>body_value</td> <td>js</td> <td><div>response.body</div></td> <td><div>{&nbsp;"resource"&nbsp;:&nbsp;{&nbsp;"name"&nbsp;:&nbsp;"a&nbsp;funky&nbsp;name",&nbsp;"data"&nbsp;:&nbsp;"an&nbsp;important&nbsp;message"&nbsp;}&nbsp;}</div></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/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>status_code_value</td> <td>js</td> <td><div>response.statusCode</div></td> <td><div>201</div></td> </tr> <tr class="slimRowColor1"> <td>let</td> <td>status_text_value</td> <td>js</td> <td><div>response.statusText</div></td> <td><div>Created</div></td> </tr> <tr class="slimRowColor0"> <td>let</td> <td>c_len</td> <td>js</td> <td><div>response.header0('Content-Length')</div></td> <td><span class="pass"><div>0</div></span></td> </tr> <tr class="slimRowColor1"> <td>let</td> <td>loc_again</td> <td>js</td> <td><div>response.header('Location',&nbsp;0)</div></td> <td><div>/resources/3</div></td> </tr> <tr class="slimRowColor0"> <td>let</td> <td>h_size</td> <td>js</td> <td><div>response.headerListSize('Location')</div></td> <td><span class="pass"><div>1</div></span></td> </tr> <tr class="slimRowColor1"> <td>let</td> <td>all_h_size</td> <td>js</td> <td><div>response.headersSize()</div></td> <td><div>3</div></td> </tr> </table> <br/>A particoular case is when the response is JSON (Content-Type : application/json). In such case, the property <b>jsonbody</b><br/>contains the JSON object that can be accessed using the dot notation. For example<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><div>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)</div></td> <td><div>{&nbsp;"resource"&nbsp;:&nbsp;{&nbsp;"name"&nbsp;:&nbsp;"a&nbsp;funky&nbsp;name",&nbsp;"data"&nbsp;:&nbsp;"an&nbsp;important&nbsp;message"&nbsp;}&nbsp;}</div></td> </tr> <tr class="slimRowColor1"> <td>let</td> <td>body_value</td> <td>js</td> <td><div>response.jsonbody</div></td> <td><div>[object&nbsp;Object]</div></td> </tr> <tr class="slimRowColor0"> <td>let</td> <td>body_value</td> <td>js</td> <td><div>response.jsonbody.resource.name</div></td> <td><span class="pass"><div>a&nbsp;funky&nbsp;name</div></span></td> </tr> </table> <br/></content> <relativePageName>LetTestsV2</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=[[[let, message, js, 'Hello, World!', Hello, World!], [let, sum, js, '2 + 5 = ' + (2 + 5), 2 + 5 = 7], [let, two_expressions, js, a=1; 'a is ' + a, a is 1], [let, json_expr, js, json = { "widget": { "debug": "on", "window": { "title": "Sample Konfabulator Widget", "name": "main_window", "width": 500, "height": 500 }, "image": { "src": "Images/Sun.png", "name": "sun1", "hOffset": 250, "vOffset": 250, "alignment": "center" }, "text": { "data": "Click Here", "size": 36, "style": "bold", "name": "text1", "hOffset": 250, "vOffset": 100, "alignment": "center", "onMouseUp": "sun1.opacity = (sun1.opacity / 100) * 90;" } } }; json.widget.image.src , Images/Sun.png]]]}</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=[[[setBody, <resource><name>Bill</name><data>Some data on Bill</data></resource>], [POST, /resources/, 201, , no-body], [let, id, header, Location:/resources/(.+), ], [let, id_string, js, 'The id is: ' + symbols.get('id'), The id is: %id%]]]}</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, 200, , ], [let, body_value, js, response.body, ], [setBody, <resource><name>Bill</name><data>Some data on Bill</data></resource>], [POST, /resources/, 201, , no-body], [let, status_code_value, js, response.statusCode, ], [let, status_text_value, js, response.statusText, ], [let, c_len, js, response.header0('Content-Length'), 0], [let, loc_again, js, response.header('Location', 0), ], [let, h_size, js, response.headerListSize('Location'), 1], [let, all_h_size, js, response.headersSize(), ]]]}</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=[[[GET, /resources/1.json, 200, , ], [let, body_value, js, response.jsonbody, ], [let, body_value, js, response.jsonbody.resource.name, a funky name]]]}</instruction> <slimResult>pass()</slimResult> <expectation> <status>pass</status> <instructionId>tableTable_4_1</instructionId> <type>TableTableExpectation</type> </expectation> </instructionResult> </instructions> </result> <finalCounts> <right>1</right> <wrong>0</wrong> <ignores>0</ignores> <exceptions>0</exceptions> </finalCounts> <totalRunTimeInMillis>124</totalRunTimeInMillis> </testResults>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy