Use of three dots for unspecified attributes on result.

27 views
Skip to first unread message

Jorn Duwel

unread,
Jun 9, 2020, 11:41:42 AM6/9/20
to XSpec
Hi!

I am wondering while browing through the example scenario's and the result of them if it is possible to get a Succesful test for a result "<elem attrib="val" />" while only specifiying "<elem>". So the number of attributes, the names of them and their values shouldn't matter. Something like "<elem ...>", so <elem attrib="val"> passes, <elem attrib2="val2'> as well, but <elem2 attrib="val"> would fail. If <elem> would pass or fail would be up for discussion I guess.

Thanks for your reply.

Regards,

Jorn Duwel

AirQuick

unread,
Jun 13, 2020, 2:30:55 AM6/13/20
to xspec...@googlegroups.com
It's currently not possible.

For the moment, maybe you can describe the expectation like this?

<x:expect test="$x:result instance of element(elem)" />
<x:expect test="$x:result/node()">
    ...expected child nodes within elem...
</x:expect>

Jorn Duwel

unread,
Jun 17, 2020, 7:37:55 AM6/17/20
to XSpec
At the moment I work around the issue by just specifying the attributes in full, but the named template that generates the attributes (and the order they are in) is covered elsewhere. I would like to prevent 'double testing'.
Thank you for your proposed solution, but the <elem> element is actually part of a specific sequence of elements. It would take a lot of expects to cover the full snippet.

Op zaterdag 13 juni 2020 08:30:55 UTC+2 schreef AirQuick:

AirQuick

unread,
Jun 23, 2020, 2:35:25 PM6/23/20
to xspec...@googlegroups.com
To satisfy other possible use cases as well as yours, maybe we need to extend the grammar

<x:expect>
   <elem x:attribute="XPath expression" />
</x:expect>

and evaluate the expression in the context of the corresponding <elem> in $x:result. If the evaluation result is true, all the attributes in the <elem> are considered as passed. In your case, you would write just <elem x:attribute="true()">. Some might write more conditions such as x:attribute="exists(@*) and empty(@foo)".

Just my quick thought. I don't know its feasibility...
--
You received this message because you are subscribed to the Google Groups "XSpec" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xspec-users...@googlegroups.com.

Jorn Duwel

unread,
Jun 26, 2020, 3:23:19 AM6/26/20
to XSpec
Yes I was thinking along somehting of that lines as wel, but your proposed solution would work even better.  However, I am somewhat new to Xspec, so I don't know if there is anything I can do to support.

Op dinsdag 23 juni 2020 20:35:25 UTC+2 schreef AirQuick:
To unsubscribe from this group and stop receiving emails from it, send an email to xspec...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages