All Downloads are FREE. Search and download functionalities are using the official Maven repository.

FitNesseRoot.files.testResults.RestFixtureTests.IssueFixes.Issue176.20160517141612_0_0_0_1.xml Maven / Gradle / Ivy

There is a newer version: 4.4
Show newest version
<?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>&lt;div class="collapsible closed"&gt;&lt;ul&gt;&lt;li&gt;&lt;a href='#' class='expandall'&gt;Expand&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href='#' class='collapseall'&gt;Collapse&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
	&lt;p class="title"&gt;Included page: &lt;a href="RestFixtureTests.SetUp"&gt;.RestFixtureTests.SetUp&lt;/a&gt; &lt;a href="RestFixtureTests.SetUp?edit&amp;amp;redirectToReferer=true&amp;amp;redirectAction=" class="edit"&gt;(edit)&lt;/a&gt;&lt;/p&gt;
	&lt;div&gt;&lt;table&gt;
	&lt;tr class="slimRowTitle"&gt;
		&lt;td&gt;script&lt;/td&gt;
		&lt;td colspan="2"&gt;&lt;span class="pass"&gt;smartrics.rest.test.fitnesse.fixture.HttpServerFixture&lt;/span&gt;&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class="slimRowColor0"&gt;
		&lt;td&gt;check&lt;/td&gt;
		&lt;td&gt;is started&lt;/td&gt;
		&lt;td&gt;&lt;span class="pass"&gt;true&lt;/span&gt;&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class="slimRowColor9"&gt;
		&lt;td colspan="3"&gt;&lt;span class="pass"&gt;reset resources database&lt;/span&gt;&lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br/&gt;&lt;h3&gt;&lt;a href="https://github.com/smartrics/RestFixture/issues/176"&gt;Issue #176&lt;/a&gt; Deep compare JSON object&lt;/h3&gt;
&lt;br/&gt;The question is how to compare JSON objects in the response. &lt;a href="RestFixture"&gt;.RestFixture&lt;/a&gt; doesn't provide, off the shelf, any method.&lt;br/&gt;But a deep compare of JSON objects can be easily achieved in &lt;a href="http://www.w3schools.com/js/"&gt;~JavaScript&lt;/a&gt;&lt;br/&gt;(see &lt;a href="http://stackoverflow.com/questions/1068834/object-comparison-in-javascript"&gt;this ~StackOverflow question&lt;/a&gt;).&lt;br/&gt;&lt;br/&gt;So, using the ability to include at runtime a &lt;a href="http://www.w3schools.com/js/"&gt;~JavaScript&lt;/a&gt; file (from &lt;a href="RestFixture"&gt;.RestFixture&lt;/a&gt; &lt;a href="http://mvnrepository.com/artifact/smartrics.restfixture/smartrics-RestFixture/4.1"&gt;4.1&lt;/a&gt; onwards), we can&lt;br/&gt;include the &lt;a href="https://github.com/smartrics/RestFixtureLiveDoc/blob/master/src/main/resources/FitNesseRoot/files/javascript/deepCompare.js"&gt;deepCompare function&lt;/a&gt;&lt;br/&gt;and use it to perform the equality check on json objects&lt;br/&gt;&lt;br/&gt;&lt;table&gt;
	&lt;tr class="slimRowTitle"&gt;
		&lt;td&gt;Table: Rest Fixture Config &lt;span class="error"&gt;Could not invoke constructor for RestFixtureConfig[1]&lt;/span&gt;&lt;/td&gt;
		&lt;td&gt;with-deepCompare.js&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class="slimRowColor0"&gt;
		&lt;td&gt;restfixture.javascript.imports.map&lt;/td&gt;
		&lt;td&gt;deepCompare=src/main/resources/FitNesseRoot/files/javascript/deepCompare.js&lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;
&lt;br/&gt;&lt;table&gt;
	&lt;tr class="slimRowTitle"&gt;
		&lt;td&gt;Table: Rest Fixture &lt;span class="error"&gt;Could not invoke constructor for RestFixture[2]&lt;/span&gt;&lt;/td&gt;
		&lt;td&gt;&lt;a href="http://localhost:9876"&gt;http://localhost:9876&lt;/a&gt;&lt;/td&gt;
		&lt;td colspan="3"&gt;with-deepCompare.js&lt;/td&gt;
	&lt;/tr&gt;
	&lt;tr class="slimRowColor0"&gt;
		&lt;td&gt;GET&lt;/td&gt;
		&lt;td&gt;/resources/1.json&lt;/td&gt;
		&lt;td&gt;200&lt;/td&gt;
		&lt;td&gt;Content-Type : application/json&lt;/td&gt;
		&lt;td&gt; /* javascript */
var expectedJson = {
    'resource' : {
        'name' : 'a funky name',
        'data' : 'an important message'
    }
};
deepCompare(jsonbody, expectedJson);
&lt;/td&gt;
	&lt;/tr&gt;
&lt;/table&gt;
&lt;br/&gt;</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=[&lt;a href="http://localhost:9876"&gt;http://localhost:9876&lt;/a&gt;, 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