![JAR search and dependency download from the Maven repository](/logo.png)
FitNesseRoot.files.testResults.RestFixtureTests.IssueFixes.Issue176.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.IssueFixes.Issue176</rootPath> <result> <counts> <right>2</right> <wrong>0</wrong> <ignores>0</ignores> <exceptions>4</exceptions> </counts> <date>2016-05-17T14:16:12+01:00</date> <runTimeInMillis>30</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/><h3><a href="https://github.com/smartrics/RestFixture/issues/176">Issue #176</a> Deep compare JSON object</h3> <br/>The question is how to compare JSON objects in the response. <a href="RestFixture">.RestFixture</a> doesn't provide, off the shelf, any method.<br/>But a deep compare of JSON objects can be easily achieved in <a href="http://www.w3schools.com/js/">~JavaScript</a><br/>(see <a href="http://stackoverflow.com/questions/1068834/object-comparison-in-javascript">this ~StackOverflow question</a>).<br/><br/>So, using the ability to include at runtime a <a href="http://www.w3schools.com/js/">~JavaScript</a> file (from <a href="RestFixture">.RestFixture</a> <a href="http://mvnrepository.com/artifact/smartrics.restfixture/smartrics-RestFixture/4.1">4.1</a> onwards), we can<br/>include the <a href="https://github.com/smartrics/RestFixtureLiveDoc/blob/master/src/main/resources/FitNesseRoot/files/javascript/deepCompare.js">deepCompare function</a><br/>and use it to perform the equality check on json objects<br/><br/><table> <tr class="slimRowTitle"> <td>Table: Rest Fixture Config <span class="error">Could not invoke constructor for RestFixtureConfig[1]</span></td> <td>with-deepCompare.js</td> </tr> <tr class="slimRowColor0"> <td>restfixture.javascript.imports.map</td> <td>deepCompare=src/main/resources/FitNesseRoot/files/javascript/deepCompare.js</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">with-deepCompare.js</td> </tr> <tr class="slimRowColor0"> <td>GET</td> <td>/resources/1.json</td> <td>200</td> <td>Content-Type : application/json</td> <td> /* javascript */ var expectedJson = { 'resource' : { 'name' : 'a funky name', 'data' : 'an important message' } }; deepCompare(jsonbody, expectedJson); </td> </tr> </table> <br/></content> <relativePageName>Issue176</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='RestFixtureConfig', args=[with-deepCompare.js]}</instruction> <slimResult></slimResult> <expectation> <status>error</status> <instructionId>tableTable_1_0</instructionId> <type>ConstructionExpectation</type> <evaluationMessage>Could not invoke constructor for RestFixtureConfig[1]</evaluationMessage> </expectation> </instructionResult> <instructionResult> <instruction>{id='tableTable_1_1', instruction='call', instanceName='tableTable_1', methodName='doTable', args=[[[restfixture.javascript.imports.map, deepCompare=src/main/resources/FitNesseRoot/files/javascript/deepCompare.js]]]}</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>, with-deepCompare.js]}</instruction> <slimResult></slimResult> <expectation> <status>error</status> <instructionId>tableTable_2_0</instructionId> <type>ConstructionExpectation</type> <evaluationMessage>Could not invoke constructor for RestFixture[2]</evaluationMessage> </expectation> </instructionResult> <instructionResult> <instruction>{id='tableTable_2_1', instruction='call', instanceName='tableTable_2', methodName='doTable', args=[[[GET, /resources/1.json, 200, Content-Type : application/json, /* javascript */ var expectedJson = { 'resource' : { 'name' : 'a funky name', 'data' : 'an important message' } }; deepCompare(jsonbody, expectedJson); ]]]}</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> </instructions> </result> <finalCounts> <right>0</right> <wrong>0</wrong> <ignores>0</ignores> <exceptions>1</exceptions> </finalCounts> <totalRunTimeInMillis>30</totalRunTimeInMillis> </testResults>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy