renatoathaydes / spock-reports

This project creates a global extension to Spock to create test reports.
Apache License 2.0
273 stars 68 forks source link

Can't set source directory #255

Open rjclancy opened 10 months ago

rjclancy commented 10 months ago

I'm trying to target a specific test directory i.e sec/main/groovy/.../integration that I would like to generate my reports but overriding this in my build gradle doesn't work

test System Property: com.athaydes.spockframework.report.testSourceRoots=src/test/groovy

Is this the correct approach?

renatoathaydes commented 10 months ago

Yes, that should work... if not, can you try the SpockConfig.groovy file as shown here?

renatoathaydes commented 10 months ago

Notice that this property is only used to include the source code in the reports:

# Set the root location of the Spock test source code (only used if showCodeBlocks is 'true')
com.athaydes.spockframework.report.testSourceRoots=src/test/groovy

Is this your problem? Or are you trying to get Spock to find your actual tests? If that's the case, then you need to change your groovy config.

rjclancy commented 10 months ago

Thanks @renatoathaydes. Yup, I just want to generate reports for tests within my src/test/groovy/integration dir exclude everything else in src/test/groovy..

renatoathaydes commented 10 months ago

So, tests are executed but no reports are generated?

rjclancy commented 10 months ago

So, tests are executed but no reports are generated?

All my tests are executed. I just would like to generate the Spock report for a specific directory.

src/main/groovy/service: don't care

src/main/groovy/integration: do care

renatoathaydes commented 10 months ago

spock-reports is called by Spock for each test that runs, there's no way to exclude tests from reports.