xspec / oXygen-XML-editor-xspec-support

An oxygen XML Editor plugin intended to help those that create XSpec scenarios.
MIT License
11 stars 10 forks source link

"Show" doesn't always work correctly for Schematron x:expect-* elements #55

Open galtm opened 6 months ago

galtm commented 6 months ago

How to reproduce the problem in Oxygen 26.1:

  1. Open an XSpec test for a Schematron schema in which a scenario contains <x:expect-valid> and <x:expect-assert>.
  2. Duplicate the <x:expect-assert>, including all its attributes, in the same XSpec file. For instance, copy the element and paste it into another scenario.
  3. Click Run XSpec test scenarios to run the test.
  4. In the XSpec Test Results window, click Show next to the listing for valid. The <x:expect-valid> element should be selected, but it isn't.
  5. Click Show next to each of the <x:expect-assert> elements. They both select the first instance of this element in the XSpec file, instead of selecting the corresponding instance.

The issue with <x:expect-assert> seems to affect <x:expect-report>, <x:expect-not-assert>, <x:expect-not-report>, and <x:expect-rule> as well.

Sample XSpec scenarios, just to make it concrete

  <x:scenario label="Scenario 1">
    <x:context>
      <foo/>
    </x:context>
    <x:expect-not-assert id="abc"/>
    <x:expect-not-report/>
    <x:expect-valid/>
  </x:scenario>
  <x:scenario label="Scenario 2">
    <x:context>
      <bar/>
    </x:context>
    <x:expect-not-report/>
    <x:expect-not-assert id="abc"/>
  </x:scenario>

(Perhaps everything fails in the example above, depending on your schema, but I don't think the pass/fail status affects the "Show" behavior I'm seeing.)

galtm commented 6 months ago

At first, I thought this issue was Schematron-specific and did not affect <x:expect> in a test for XSLT or XQuery. I changed my mind. In the sample code below in a test for XSLT or XQuery, the duplicate scenario labels (in addition to duplicate <x:expect> elements) seem relevant.

  <x:scenario label="Top-level scenario 1">
    <x:scenario label="fcn with no parameters">
      <x:call function="true"/>
      <x:expect label="passes" test="1 gt 0"/>
      <x:expect label="fails" test="1 eq 2"/>
    </x:scenario>
  </x:scenario>
  <x:scenario label="Top-level scenario 2">
    <x:scenario label="fcn with no parameters">
      <x:call function="false"/>
      <x:expect label="fails" test="1 eq 2"/>
      <x:expect label="passes" test="1 gt 0"/>
    </x:scenario>
  </x:scenario>