tests in XML [Re: Re: PULL Parser in PHP]

Aleksander Slominski <[email protected]>
Newsgroups gmane.text.xml.xmlpull.devel
Message-ID <[email protected]>
lrargerich wrote:

> Good I'll see your work by monday and send ideas/suggestions thinking
> about a XSLT implementation. I guess that the XML test docs should be
> delivered as strings maybe in CDATA sections of the XML test vocabulary.
>
> Then it will be easy to write a XSLT stylesheet , something like this:
>
> <test name="initial test">
> <xmlsource><![CDATA[ <foo></foo> ]]>
> <testCode>
> <createParser/>
> <setFeature name="BLAH" value="blah />
> <expect type="START_DOCUMENT" nameNS="" localname="" />
> <execute method="next()"/>
> <expect type="START_TAG" nameNS="" localName="foo">
> <execute method="isEmptyElement()" into="t1" />
> <assertVar name="t1" value="true" />
> <execute method="next()"/>
> <expect type="END_TAG" nameNS="" localName="foo" />
> <execute method="next()"/>
> <expect type="END_DOCUMENT" nameNS="" localName="" />
> </testCode>
> </test>
>
> For methods returning values we can use
> <execute method="getName()" into="foo">
> <assertVar name="foo" value="root">
>
> execute executes a method and if into is defined assigns the return
> value of the method to the variable indicated by name in the into
> attribute.

that unfortunately looks to close to programming language and i am
just a bit scared that it is too flexible - it is not possible
check that wrong method is executed
    <execute method="getFoo()" into="foo">


> into indicates the name of a variable, assertVar tests if a variable
> has the desired value if not it throws an exception.
>
> Then a test case is easy to run if no exceptions then test=ok ,
> exceptions may come from the parser (example an expect that fails) or
> from failed asserVars.
>
> It will be important to keep the test vocabulary as minimalistic as we
> can so the XSLT stylesheets are simple and easy to write allowing test
> cases in many different languages.
>
> Just some thoughts for you to start
>
> --- In xmlpull-dev@y..., Aleksander Slominski <aslom@e...> wrote:
> > lrargerich wrote:
> >
> > > I love the idea to write the tests as XML, then convert the XML to
> > > X-Language using XSLT, then run the code and the code should directly
> > > show if the tests passed or failed.
> >
> > that is very interesting idea ! XSLT could be also used to get test
> results
> > nicely converted into HTML output...
> >
> > > Based on this assumption I think that the vocabulary for defining the
> > > tests should be refined to allow an easy XSLT translation to code, If
> > > you can think about the vocabulary and/or format I may try to write
> > > the XSLT to PHP and someone (?) can write the XSLT to Java. Then it
> > > will be easy to write tests and as long as the XSLT exists you can
> > > test it in all the supported languages.
> >
> > if you want to give it a try please do it and we will make then sure
> > that schema for XML is defined in such way to make job of writing
> > XSLT as easy as possible!
> >
> > i am not very good in XSLT but i think that it is possible to call
> > java code directly from XSLT?
> >
> > i will work on it during weekend and  i will post a preliminary
> > and simple XML schema for tests and java driver to execute them.
> >
> >
> > thanks,
> >
> > alek
>
>
> To unsubscribe from this group, send an email to:
> [email protected]
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.