SAT: XML

SAT: Socket Acceptance Test: XML

Rick Mugridge, University of Auckland, October 2002

r.mugridge@auckland.ac.nz

Sat is a framework for testing socket-based servers, as defined elsewhere (TestSAT.html). We focus here on the processing of messages that are encoded in XML.

A SatXmlFixture is the same as a SatFixture, except that the messages sent and received are in XML. This means that:

XML Tests

Atttributes

A ServerEcho just sends back what it receives.

sat.fit.SatXmlFixture
startServersat.mockServer.ServerEcho
comment Shorthand tag works fine:
send <Hello></Hello>
rx <Hello/>
comment Spaces in tag don't matter:
send <Hello    a="1"  />
rx <Hello a="1"/>
comment Attributes the same:
send <Hello a="1" b="2"></Hello>
rx <Hello a="1" b="2"/>
send <Hello b="2"   a="1" ></Hello>
rx <Hello a="1" b="2"/>
comment Attributes differ:
send <Hello a="1"  />
rxDiffers <Hello a="2"/>
send <Hello b="2"   a="1" />
rxDiffers <Hello a="1" b="2" c="3"/>
send <Hello b="2"   a="1" />
rxDiffers <Hello a="1" b="3"/>
send <Shutdown/>
stopServer

Elements and Text

sat.fit.SatXmlFixture
startServersat.mockServer.ServerEcho
send <Hello>abc</Hello>
rx <Hello>abc</Hello>
send <Hello    a="1"  >abc</Hello>
rx <Hello a="1" >abc</Hello>
comment Spaces don't matter around tags:
send <Hello>    <Hi/>      <Hiss/> </Hello>
rx <Hello><Hi/><Hiss/></Hello>
send <Hello>    <Hi/><A>x</A><Hi/> </Hello>
rx <Hello><Hi/><A>x</A><Hi/></Hello>
comment Spaces do matter around text:
send <Hello><Hi/><A>x</A><Hi/></Hello>
rxDiffers <Hello><Hi/><A>   x  </A><Hi/></Hello>
comment Order matters:
send <Hello>    <Hi/>      <Hiss/> </Hello>
rxDiffers <Hello><Hiss/><Hi/></Hello>
comment All elements need to be there:
send <Hello><Hi/><Hiss/></Hello>
rxDiffers <Hello><Hiss/></Hello>
send <Shutdown/>
stopServer

Using HTML tags for layout

HTML tags may be used for layout in a cell. They are stripped off before the XML is used.

sat.fit.SatXmlFixture
startServersat.mockServer.ServerEcho
send <Gidday>

</Gidday>

rx <Gidday/>
send <Gidday>
  • <one/>
  • <two/>
  • <three/>

</Gidday>

rx <Gidday><one/><two/><three/></Gidday>
send <Shutdown/>
stopServer

Summary

fit.Summary