[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Fwd: Not using mixed content? Then don't use XML

  • From: Andrew Welch <andrew.j.welch@gmail.com>
  • To: Rick Jelliffe <rjelliffe@allette.com.au>
  • Date: Wed, 10 Apr 2013 09:13:08 +0100

Re: Fwd:  Not using mixed content? Then don't use XML
On 10 April 2013 06:23, Rick Jelliffe <rjelliffe@allette.com.au> wrote:
> Ghost? Boo!
>
> I have four other angles:
>
> 1) Test driven development.   Before=as=so-soon-after-that-noone-notices
> you make some software, you make a test for it.  If the document has a fixed
> structure, you can test by instances. If the document is semi-structured or
> recursive, your test specification has to allow those kinds of structures
> too: and for XML such a specification is called a schema.

Using a schema here can only get you so far.... it wont catch
hardcoded elements or (yet again) the business rules (unless they are
in the schema)

You need an additional layer that tests by pulling the values out from
the input (or wherever the values in the result are taken from) and
comparing them to the result.  My tests are along the lines of:

String someValue = runQueryOnInput("/some/path/to/val/string(.)");

String valueInResult = runQueryOnOutput("/result/path/to/val/string(.)");

assertEquals(someValue, valueInResult);

...eg it uses xquery to select a value from the input xml, and again
to select a value from the result, then does the assert.   (I have
simple test framework I wrote that allows the tests to be simple like
this).

For business rules that only apply to the result such as "if nnn is
true then every yyy must be false" you can do:

assertTrue(Boolean.valueOf(runQueryOnOutput("if (nnn = 'true') then
not(yyy = 'true') else true()")

...or whatever you test you can conjure up in xquery.

So while validating the result is essential, it's not always
sufficient on its own.


-- 
Andrew Welch
http://andrewjwelch.com


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.