* Randy J. Ray <[EMAIL PROTECTED]> [2008-04-07 02:00]:
> Right now, I plan on:
> 
> * XML validity against a DTD
> * XML validity against a XML schema
> * XML validity against a RelaxNG schema
> * YAML validity
> * JSON validity
> * Content testing via some combo of Test::Deep and/or built-in
>   capabilities from Test::JSON et al
> 
> This is based mostly from Ovid's post, but also from the
> realization that for these. most of the desired kinds of tests
> are the same: Does it parse? Is it valid against the spec? Is
> the content what I was expecting (allowing for acceptable
> variations in textual format)?

I’m not sure it makes so much sense to put those all together.
YAML and JSON map directly to Perl data structures, so a “schema”
test for both of them would be identical and would amount to
something like Data::FormValidator, Params::Validate and friends.

XML, on the other hand, has a much more complex data model that
does not at all map directly to a Perl data structure. XML is at
its best when it comes to documents, not data structures.

So I’m not sure it makes a whole lot of sense to mix it all up.
I also don’t think it makes a lot of sense to treat JSON and YAML
as particularly distinct, or that it makes a lot of sense to pay
any attention to their on-disk form as opposed to the resultant
in-memory data structure.

The only question that’s identical across the board is “does this
parse at all,” which in the case of XML means “is this well-
formed” but **not** “is this valid according to that schema or
DTD or grammar.”

Beyond that, the questions diverge: in the case of YAML and JSON,
you want Test::Deep/Data::FormValidator/Params::Validate/something
along those lines to operate directly on the data structure. In
the case of XML, you want to validate against some schema. The
shortcuts and conveniences you’ll want in a Test:: module differ
between those cases.

> Right now, I'm leaning towards Test::Markup. That might wind up
> the YAML guys a bit, though (which is actually a
> quite-acceptable bonus to me), possibly the JSON camp as well.

It’s definitely the wrong name. By that token, the output of
Data::Dumper is markup. I, uh, don’t think that’s right.

> So I am also considering Test::Serialization, since all of
> these amount to forms of serialization. Even (some would say
> *especially*) XML.

Indeed, XML is a serialisation format… but for a very different
kind of thing than what YAML and JSON both are serialisation
formats: DOM here, Perl data structure there.

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>

Reply via email to