JUnit XML not generated for interpolated specs #163

Closed
asflierl opened this Issue May 24, 2013 · 8 comments

Comments

Projects
None yet
2 participants
@asflierl
Contributor

asflierl commented May 24, 2013

Hi,

just run any spec that uses the s2 interpolator (I used the example from issue #162 ) with SBT and Tests.Argument("junitxml") and you can observe that the generated JUnit XML does not contain any <testcase> tags for the examples.

etorreborre added a commit that referenced this issue May 24, 2013

@etorreborre

This comment has been minimized.

Show comment
Hide comment
@etorreborre

etorreborre May 24, 2013

Owner

This is going to be a fun one as well! It's really hard to shoehorn specs2 into JUnit. The partial fix above will at least create the test cases but the naming is funky.

Owner

etorreborre commented May 24, 2013

This is going to be a fun one as well! It's really hard to shoehorn specs2 into JUnit. The partial fix above will at least create the test cases but the naming is funky.

@etorreborre

This comment has been minimized.

Show comment
Hide comment
@etorreborre

etorreborre May 25, 2013

Owner

I think I've got a better fix for it now, please use it (with RC2-SNAPSHOT) and tell me: 1. if it works, 2. if anything can be improved. Thanks.

Owner

etorreborre commented May 25, 2013

I think I've got a better fix for it now, please use it (with RC2-SNAPSHOT) and tell me: 1. if it works, 2. if anything can be improved. Thanks.

@asflierl

This comment has been minimized.

Show comment
Hide comment
@asflierl

asflierl May 27, 2013

Contributor

Basically, it seems to work fine... but for some reason I cannot quite understand, the following spec has 7 tests (which is also reported this way by sbt) while the generated JUnit XML contains only 6 test cases:

class Meep extends SpecificationWithJUnit { def is = s2"""
This is a simple, hierarchial specification
  If things are indented
    and examples are nested              $ok
    this should be reflected
      in the console                     $ok
      as well as the HTML report         $ko
    just as expected
      by me                              $ok
      or maybe someone else              $todo
    or if there's only text, indentation
    possibly on multiple following lines
      should also work                   $ok
      and not quote lines as code        $ko
"""
}

(the first one is missing: and examples are nested)

Also, the fist two lines of the spec appear twice in each generated test case name. This is not a big deal but rather cosmetically not so nice.

Contributor

asflierl commented May 27, 2013

Basically, it seems to work fine... but for some reason I cannot quite understand, the following spec has 7 tests (which is also reported this way by sbt) while the generated JUnit XML contains only 6 test cases:

class Meep extends SpecificationWithJUnit { def is = s2"""
This is a simple, hierarchial specification
  If things are indented
    and examples are nested              $ok
    this should be reflected
      in the console                     $ok
      as well as the HTML report         $ko
    just as expected
      by me                              $ok
      or maybe someone else              $todo
    or if there's only text, indentation
    possibly on multiple following lines
      should also work                   $ok
      and not quote lines as code        $ko
"""
}

(the first one is missing: and examples are nested)

Also, the fist two lines of the spec appear twice in each generated test case name. This is not a big deal but rather cosmetically not so nice.

@etorreborre

This comment has been minimized.

Show comment
Hide comment
@etorreborre

etorreborre May 27, 2013

Owner

Not good, I'm going to have a look at that.

Owner

etorreborre commented May 27, 2013

Not good, I'm going to have a look at that.

@etorreborre etorreborre reopened this May 27, 2013

@etorreborre

This comment has been minimized.

Show comment
Hide comment
@etorreborre

etorreborre May 27, 2013

Owner

This is what I get with RC2-SNAPSHOT, 7 cases (I just reordered them):

<testcase name="This is a simple, hierarchial specification  If things are indented::and examples are nested" classname="examples.TestSpec" time="0.051">
</testcase>
<testcase name="This is a simple, hierarchial specification  If things are indented::this should be reflected::in the console" classname="examples.TestSpec" time="0.042">
</testcase>
<testcase name="This is a simple, hierarchial specification  If things are indented::or if there's only text, indentation    possibly on multiple following lines::and not quote lines as code" classname="examples.TestSpec" time="0.053">
        <failure message="ko" type="java.lang.Exception">examples.TestSpec$$anonfun$is$7.apply(TestSpec.scala:18)
examples.TestSpec$$anonfun$is$7.apply(TestSpec.scala:18)</failure>
</testcase>
<testcase name="This is a simple, hierarchial specification  If things are indented::just as expected::by me" classname="examples.TestSpec" time="0.051">
</testcase>
<testcase name="This is a simple, hierarchial specification  If things are indented::just as expected::or maybe someone else" classname="examples.TestSpec" time="0.032">
  <skipped/>
</testcase>
<testcase name="This is a simple, hierarchial specification  If things are indented::or if there's only text, indentation    possibly on multiple following lines::should also work" classname="examples.TestSpec" time="0.042">
</testcase>
<testcase name="This is a simple, hierarchial specification  If things are indented::this should be reflected::as well as the HTML report" classname="examples.TestSpec" time="0.054">
        <failure message="ko" type="java.lang.Exception">examples.TestSpec$$anonfun$is$7.apply(TestSpec.scala:18)
examples.TestSpec$$anonfun$is$7.apply(TestSpec.scala:18)</failure>
</testcase>
Owner

etorreborre commented May 27, 2013

This is what I get with RC2-SNAPSHOT, 7 cases (I just reordered them):

<testcase name="This is a simple, hierarchial specification  If things are indented::and examples are nested" classname="examples.TestSpec" time="0.051">
</testcase>
<testcase name="This is a simple, hierarchial specification  If things are indented::this should be reflected::in the console" classname="examples.TestSpec" time="0.042">
</testcase>
<testcase name="This is a simple, hierarchial specification  If things are indented::or if there's only text, indentation    possibly on multiple following lines::and not quote lines as code" classname="examples.TestSpec" time="0.053">
        <failure message="ko" type="java.lang.Exception">examples.TestSpec$$anonfun$is$7.apply(TestSpec.scala:18)
examples.TestSpec$$anonfun$is$7.apply(TestSpec.scala:18)</failure>
</testcase>
<testcase name="This is a simple, hierarchial specification  If things are indented::just as expected::by me" classname="examples.TestSpec" time="0.051">
</testcase>
<testcase name="This is a simple, hierarchial specification  If things are indented::just as expected::or maybe someone else" classname="examples.TestSpec" time="0.032">
  <skipped/>
</testcase>
<testcase name="This is a simple, hierarchial specification  If things are indented::or if there's only text, indentation    possibly on multiple following lines::should also work" classname="examples.TestSpec" time="0.042">
</testcase>
<testcase name="This is a simple, hierarchial specification  If things are indented::this should be reflected::as well as the HTML report" classname="examples.TestSpec" time="0.054">
        <failure message="ko" type="java.lang.Exception">examples.TestSpec$$anonfun$is$7.apply(TestSpec.scala:18)
examples.TestSpec$$anonfun$is$7.apply(TestSpec.scala:18)</failure>
</testcase>
@etorreborre

This comment has been minimized.

Show comment
Hide comment
@etorreborre

etorreborre May 27, 2013

Owner

Andreas, thinking about it again I suppose that you have a stale SNAPSHOT. What you are observing is the partial fix I first committed if I remember correctly.

Owner

etorreborre commented May 27, 2013

Andreas, thinking about it again I suppose that you have a stale SNAPSHOT. What you are observing is the partial fix I first committed if I remember correctly.

@asflierl

This comment has been minimized.

Show comment
Hide comment
@asflierl

asflierl May 27, 2013

Contributor

Oh, hmm, I got the snapshot just this morning from sonatype OSS snapshots. I'll try again.

Contributor

asflierl commented May 27, 2013

Oh, hmm, I got the snapshot just this morning from sonatype OSS snapshots. I'll try again.

@asflierl

This comment has been minimized.

Show comment
Hide comment
@asflierl

asflierl May 27, 2013

Contributor

Yep, cleaned + downloaded again -> now it works fine. Thank you!

Contributor

asflierl commented May 27, 2013

Yep, cleaned + downloaded again -> now it works fine. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment