Uploaded image for project: 'Clover'
  1. Clover
  2. CLOV-1256

as a developer I'd like to instrument tests written in the Spock framework

    XMLWordPrintable

Details

    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

    Description

      We use Clover for both Java and Groovy.

      Unfortunately, Clover does not understand the tests we write in Spock.

      So a test like this:

      class OpsWiseJobQueryTestSpec extends AbstractTestSpec {
      	OpsWiseJobQuery wait
      	static File existingFileMarker = File.createTempFile("opswiseJobQuery", ".txt")
      	
      	void setup() {
      		wait = new OpsWiseJobQuery()
      		wait.manifestDir = existingFileMarker.getParentFile()
      		existingFileMarker.createNewFile()
      	}
      	
      	void cleanup() {
      		existingFileMarker.delete()
      	}
      	
      	def "should work with completed job"() {
      		expect:
      			state == wait.getJobState(manifestFilename)
      		where:
      			state						|	manifestFilename
      			OpsWiseJobState.WAITING 	|   "non-existing-name.whatever"
      			OpsWiseJobState.DONE		|	existingFileMarker.getName()
      	}	
      }
      

      Ends up with a coverage report like this:

      Class 	Tests 	Fail 	Error 	Time (secs) 	% Tests Success
      OpsWiseJobQueryTestSpec 	12 	0 	0 	0,026 	100% 	
       
      Tests 	Started 	Status 	Time (secs) 	Message
      OpsWiseJobQueryTestSpec. 	12 mar 10:32:50 	PASS 	0 	 
      OpsWiseJobQueryTestSpec.$spock_feature_1_0 	12 mar 10:32:49 	PASS 	0,001 	 
      OpsWiseJobQueryTestSpec. 	12 mar 10:32:49 	PASS 	0 	 
      OpsWiseJobQueryTestSpec.setup 	12 mar 10:32:49 	PASS 	0,009 	 
      OpsWiseJobQueryTestSpec. 	12 mar 10:32:50 	PASS 	0,001 	 
      OpsWiseJobQueryTestSpec.$spock_feature_1_0 	12 mar 10:32:50 	PASS 	0 	 
      OpsWiseJobQueryTestSpec.cleanup 	12 mar 10:32:50 	PASS 	0,01 	 
      OpsWiseJobQueryTestSpec.setup 	12 mar 10:32:50 	PASS 	0,001 	 
      OpsWiseJobQueryTestSpec.cleanup 	12 mar 10:32:50 	PASS 	0,001 	 
      OpsWiseJobQueryTestSpec. 	12 mar 10:32:49 	PASS 	0,002 	 
      OpsWiseJobQueryTestSpec. 	12 mar 10:32:49 	PASS 	0,001 	 
      OpsWiseJobQueryTestSpec. 	12 mar 10:32:49 	PASS 	0 	  
      

      I would expect to see just a single test passed.

      Attachments

        Issue Links

          Activity

            People

              mparfianowicz Marek Parfianowicz
              365070a405d9 Jesper Skov
              Votes:
              5 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: