Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I would start with a well-formed document of the same type from another source that contains one or two elements of each type that my api can produce. Trim this document manually to remove excessive duplication--and check it is still well-formed. My test application would be to reproduce this document.

My test would not be a simple textual compare, as the layout of two functionally identical XML docs can vary enormously without there being an error. So, I would use one of the XML parsing modules that produces a dumpable hierarchal object and the test would be comparing the dumped (with sorting where applicable) parse-trees.

I'd use diff (the program rather than module) to compare the dumped trees. I'd combine two passes with a shell script &&. The first would use the -q switch to just test same/different. And if it fails, it would invoke the second pass that would use the -y switch piped to more* to present the differences on screen, so that I could inspect them and decide what corrections or addition I would make next.

*I'd probably use windiff for the second pass, its visualisation is easier to digest.

You can set the test up before you start developing the API and get direct feedback as you go along as to what you have done so far, what corrections you need to make, and what needs to be done next.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re: When Test Suites Attack by BrowserUk
in thread When Test Suites Attack by Ovid

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others browsing the Monastery: (2)
    As of 2021-02-28 04:21 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found

      Notices?