![JAR search and dependency download from the Maven repository](/logo.png)
FitNesseRoot.files.testResults.RestFixtureTests.LetTestsV2.20160517141612_0_0_0_1.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>v20151230</FitNesseVersion> <rootPath>RestFixtureTests.LetTestsV2</rootPath> <result> <counts> <right>2</right> <wrong>0</wrong> <ignores>0</ignores> <exceptions>12</exceptions> </counts> <date>2016-05-17T14:16:12+01:00</date> <runTimeInMillis>38</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 <a href="RestFixture">.RestFixture</a>. 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>Table: Rest Fixture <span class="error">Could not invoke constructor for RestFixture[1]</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>'Hello, World!'</td> <td>Hello, World!</td> </tr> <tr class="slimRowColor1"> <td>let</td> <td>sum</td> <td>js</td> <td>'2 + 5 = ' + (2 + 5)</td> <td>2 + 5 = 7</td> </tr> <tr class="slimRowColor0"> <td>let</td> <td>two_expressions</td> <td>js</td> <td>a=1; 'a is ' + a</td> <td>a is 1</td> </tr> <tr class="slimRowColor1"> <td>let</td> <td>json_expr</td> <td>js</td> <td> 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 </td> <td>Images/Sun.png</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>Table: Rest Fixture <span class="error">Could not invoke constructor for RestFixture[1]</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>/resources/</td> <td>201</td> <td></td> <td>no-body</td> </tr> <tr class="slimRowColor0"> <td>let</td> <td>id</td> <td>header</td> <td>Location:/resources/(.+)</td> <td></td> </tr> <tr class="slimRowColor1"> <td>let</td> <td>id_string</td> <td>js</td> <td>'The id is: ' + symbols.get('id')</td> <td>The id is: %id%</td> </tr> </table> <br/>Symbols that don't exist return null (or, in fact, the null representation set via the<br/>'restfixture.null.value.representation' confuguration variable.<br/><br/><table> <tr class="slimRowTitle"> <td>Table: Rest Fixture Config <span class="error">Could not invoke constructor for RestFixtureConfig[1]</span></td> <td>reassing_null_representation</td> </tr> <tr class="slimRowColor0"> <td>restfixture.null.value.representation</td> <td>da_nil_123</td> </tr> </table> <br/><table> <tr class="slimRowTitle"> <td>Table: Rest Fixture <span class="error">Could not invoke constructor for RestFixture[2]</span></td> <td><a href="http://localhost:9876">http://localhost:9876</a></td> <td colspan="3">reassing_null_representation</td> </tr> <tr class="slimRowColor0"> <td>let</td> <td>x</td> <td>js</td> <td>String(symbols.get('doesnt_exist'))</td> <td>da_nil_123</td> </tr> </table> <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>Table: Rest Fixture <span class="error">Could not invoke constructor for RestFixture[1]</span></td> <td colspan="4"><a href="http://localhost:9876">http://localhost:9876</a></td> </tr> <tr class="slimRowColor0"> <td>GET</td> <td>/resources/1</td> <td>200</td> <td></td> <td></td> </tr> <tr class="slimRowColor1"> <td>let</td> <td>body_value</td> <td>js</td> <td>response.body</td> <td></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>/resources/</td> <td>201</td> <td></td> <td>no-body</td> </tr> <tr class="slimRowColor0"> <td>let</td> <td>status_code_value</td> <td>js</td> <td>response.statusCode</td> <td></td> </tr> <tr class="slimRowColor1"> <td>let</td> <td>status_text_value</td> <td>js</td> <td>response.statusText</td> <td></td> </tr> <tr class="slimRowColor0"> <td>let</td> <td>c_len</td> <td>js</td> <td>response.header0('Content-Length')</td> <td>0</td> </tr> <tr class="slimRowColor1"> <td>let</td> <td>loc_again</td> <td>js</td> <td>response.header('Location', 0)</td> <td></td> </tr> <tr class="slimRowColor0"> <td>let</td> <td>h_size</td> <td>js</td> <td>response.headerListSize('Location')</td> <td>1</td> </tr> <tr class="slimRowColor1"> <td>let</td> <td>all_h_size</td> <td>js</td> <td>response.headersSize()</td> <td></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>Table: Rest Fixture <span class="error">Could not invoke constructor for RestFixture[1]</span></td> <td colspan="4"><a href="http://localhost:9876">http://localhost:9876</a></td> </tr> <tr class="slimRowColor0"> <td>GET</td> <td>/resources/1.json</td> <td>200</td> <td></td> <td> jsonbody.resource.name=="a funky name" jsonbody.resource.data=="an important message" </td> </tr> <tr class="slimRowColor1"> <td>let</td> <td>body_value</td> <td>js</td> <td>response.jsonbody</td> <td></td> </tr> <tr class="slimRowColor0"> <td>let</td> <td>body_value</td> <td>js</td> <td>response.jsonbody.resource.name</td> <td>a funky name</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></slimResult> <expectation> <status>error</status> <instructionId>tableTable_1_0</instructionId> <type>ConstructionExpectation</type> <evaluationMessage>Could not invoke constructor for RestFixture[1]</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></slimResult> <expectation> <status>error</status> <instructionId>tableTable_1_1</instructionId> <type>TableTableExpectation</type> <evaluationMessage>The instance tableTable_1.doTable. does not exist</evaluationMessage> </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></slimResult> <expectation> <status>error</status> <instructionId>tableTable_2_0</instructionId> <type>ConstructionExpectation</type> <evaluationMessage>Could not invoke constructor for RestFixture[1]</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></slimResult> <expectation> <status>error</status> <instructionId>tableTable_2_1</instructionId> <type>TableTableExpectation</type> <evaluationMessage>The instance tableTable_2.doTable. does not exist</evaluationMessage> </expectation> </instructionResult> <instructionResult> <instruction>{id='tableTable_3_0', instruction='make', instanceName='tableTable_3', className='RestFixtureConfig', args=[reassing_null_representation]}</instruction> <slimResult></slimResult> <expectation> <status>error</status> <instructionId>tableTable_3_0</instructionId> <type>ConstructionExpectation</type> <evaluationMessage>Could not invoke constructor for RestFixtureConfig[1]</evaluationMessage> </expectation> </instructionResult> <instructionResult> <instruction>{id='tableTable_3_1', instruction='call', instanceName='tableTable_3', methodName='doTable', args=[[[restfixture.null.value.representation, da_nil_123]]]}</instruction> <slimResult></slimResult> <expectation> <status>error</status> <instructionId>tableTable_3_1</instructionId> <type>TableTableExpectation</type> <evaluationMessage>The instance tableTable_3.doTable. does not exist</evaluationMessage> </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>, reassing_null_representation]}</instruction> <slimResult></slimResult> <expectation> <status>error</status> <instructionId>tableTable_4_0</instructionId> <type>ConstructionExpectation</type> <evaluationMessage>Could not invoke constructor for RestFixture[2]</evaluationMessage> </expectation> </instructionResult> <instructionResult> <instruction>{id='tableTable_4_1', instruction='call', instanceName='tableTable_4', methodName='doTable', args=[[[let, x, js, String(symbols.get('doesnt_exist')), da_nil_123]]]}</instruction> <slimResult></slimResult> <expectation> <status>error</status> <instructionId>tableTable_4_1</instructionId> <type>TableTableExpectation</type> <evaluationMessage>The instance tableTable_4.doTable. does not exist</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></slimResult> <expectation> <status>error</status> <instructionId>tableTable_5_0</instructionId> <type>ConstructionExpectation</type> <evaluationMessage>Could not invoke constructor for RestFixture[1]</evaluationMessage> </expectation> </instructionResult> <instructionResult> <instruction>{id='tableTable_5_1', instruction='call', instanceName='tableTable_5', 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></slimResult> <expectation> <status>error</status> <instructionId>tableTable_5_1</instructionId> <type>TableTableExpectation</type> <evaluationMessage>The instance tableTable_5.doTable. does not exist</evaluationMessage> </expectation> </instructionResult> <instructionResult> <instruction>{id='tableTable_6_0', instruction='make', instanceName='tableTable_6', className='RestFixture', args=[<a href="http://localhost:9876">http://localhost:9876</a>]}</instruction> <slimResult></slimResult> <expectation> <status>error</status> <instructionId>tableTable_6_0</instructionId> <type>ConstructionExpectation</type> <evaluationMessage>Could not invoke constructor for RestFixture[1]</evaluationMessage> </expectation> </instructionResult> <instructionResult> <instruction>{id='tableTable_6_1', instruction='call', instanceName='tableTable_6', methodName='doTable', args=[[[GET, /resources/1.json, 200, , jsonbody.resource.name=="a funky name" jsonbody.resource.data=="an important message" ], [let, body_value, js, response.jsonbody, ], [let, body_value, js, response.jsonbody.resource.name, a funky name]]]}</instruction> <slimResult></slimResult> <expectation> <status>error</status> <instructionId>tableTable_6_1</instructionId> <type>TableTableExpectation</type> <evaluationMessage>The instance tableTable_6.doTable. does not exist</evaluationMessage> </expectation> </instructionResult> </instructions> </result> <finalCounts> <right>0</right> <wrong>0</wrong> <ignores>0</ignores> <exceptions>1</exceptions> </finalCounts> <totalRunTimeInMillis>38</totalRunTimeInMillis> </testResults>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy