Skip to content

XSpec test fails but Maven process reports success #65

@galtm

Description

@galtm

I have a case where an <x:expect> element in the XSpec test produces a failure, but the overall Maven process reports success. Here is a small test that reproduces the issue. (The XSLT stylesheet can be anything because it's not actually used.)

<?xml version="1.0" encoding="UTF-8"?>
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec"
         stylesheet="something.xsl" xslt-version="3.0">

  <x:scenario shared="yes" label="shared passing assertion">
    <x:expect label="passing assertion" test="true()"/>
  </x:scenario>
  
  <x:scenario label="Scenario with failing assertion that Maven plugin misses">
    <x:call function="string">
      <x:param select="'a'"/>
    </x:call>
    <x:expect label="failing assertion" select="'b'"/>
  </x:scenario>  

  <x:scenario label="Scenario that references shared assertion more than once">
    <x:scenario label="case 1">
      <x:call function="string">
        <x:param select="'a'"/>
      </x:call>
      <x:like label="shared passing assertion"/>
    </x:scenario>
    <x:scenario label="case 2">
      <x:call function="string">
        <x:param select="'z'"/>
      </x:call>
      <x:like label="shared passing assertion"/>
    </x:scenario>
  </x:scenario>

</x:description>

After I do mvn test the result includes the following.

9810 [INFO] Executing XSpec: repro-steps.xspec.xslt
Testing with SAXON EE 9.9.1.2
Scenario with failing assertion that Maven plugin misses
failing assertion
      FAILED
Scenario that references shared assertion more than once
..case 1
passing assertion
..case 2
passing assertion
passed: 2 / pending: 0 / failed: 1 / total: 3
9914 [INFO] repro-steps.xspec results [Passed/Pending/Failed/Missed/Total] = [2/0/1/-1/2]
9929 [INFO] ------------------------------------------------------------------------
9929 [INFO] BUILD SUCCESS
9929 [INFO] ------------------------------------------------------------------------

The problem seems to be related to code reuse in the XSpec test via the <x:like> element. If I delete one of the <x:like> elements or replace it with the content of the shared scenario, the problem goes away.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions