Allow multiple ways of finding "test" methods (during the same clover run)

XMLWordPrintable

    • Type: Suggestion
    • Resolution: Fixed
    • 2.0.3
    • Component/s: Ant Tasks
    • None
    • Environment:
      Linux duke 2.6.22-14-generic #1 SMP Sun Oct 14 23:05:12 GMT 2007 i686 GNU/Linux

      Instinct provides multiple ways for users to define specification methods. For example the following three methods all represent a specification method (equivalent to an xUnit test method), one based on a annotation, and two based on naming conventions (a regex).

      @Specification
      public void mySPecificationMethod {
      }
      
      public void shouldBeASpecificationMethod {
      }
      
      public void mustBeASpecificationMethod {
      }
      

      Clover supports using the annotation to define the spec as follows:

      Clover is enabled/configured as follows:

      <clover-setup>
          <fileset refid="main.covered.fileset"/>
          <testsources dir="${spec.src.dir}">
              <testclass>
                  <testmethod annotation="Specification"/>
              </testclass>
          </testsources>
      </clover-setup>
      

      However does not seem to support all three methods. Either like this:

      <clover-setup>
          <fileset refid="main.covered.fileset"/>
          <testsources dir="${spec.src.dir}">
              <testclass>
                  <testmethod annotation="Specification"/>
                  <testmethod name="^should.*"/>
                  <testmethod name="^must.*"/>
              </testclass>
          </testsources>
      </clover-setup>
      

      This method fails to find any specification methods, reporting all "test" classes as main sources. I assume this is an "and" rather than an "or" on the method attributes (i.e. specs will not have all of these attributes). It'd be nice to have this better documented also.

      The following also does not work, though it appears to be valid from the schema and Ant fileset usages.

      <clover-setup>
          <fileset refid="main.covered.fileset"/>
          <testsources dir="${spec.src.dir}">
              <testclass>
                  <testmethod annotation="Specification"/>
              </testclass>
          </testsources>
          <testsources dir="${spec.src.dir}">
              <testclass>
                  <testmethod name="^should.*"/>
              </testclass>
          </testsources>
          <testsources dir="${spec.src.dir}">
              <testclass>
                  <testmethod name="^must.*"/>
              </testclass>
          </testsources>
      </clover-setup>
      

      Note that this last method correctly bundles classes containing spec methods into the "test" tab in the report, but does not report them as contributing to the coverage.

      Using the annotation alone does the correct thing, though only for annotated methods.

        There are no Sub-Tasks for this issue.

            Assignee:
            Unassigned
            Reporter:
            Tom Adams
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: