Originally Posted: http://stackoverflow.com/questions/29127169/tag-geb-classes-tests-for-exclusion
I am trying to create a simple way for excluding Geb tests from running based off of not having an optional "tag".
In my grails project I have created a "test/functional" directory for my geb files to reside. Inside this directory I have the GebConfig.groovy and SpockConfig.groovy files. I am aware that SpockConfig.groovy currently has an issue with being able to resolve classes in the project and only recognises classes provided in the BuildConfig dependencies. As such, I have created and jar'ed an annotation class "Tags" and included it in the dependencies. I can now use this annotation on my Geb tests in the following manner:
@Tags("regression")
@Tags(["smoke", "regression"])
@Tags(["in-progress", "whatever-makes-sense"])
What I would like to have now is for the SpockConfig to find all the classes in the "test/functional" directory with the @Tags annotation, and for each one that does not have System.getenv("functional.tag") in the tags array, to add the class to the runner.exclude base classes collection so it will not execute.
I am fairly new to Annotations and the processing thereof, and so far have not found an easy way to perform the lookup logic of this process. Are there existing constructs that facilitate such a process, or what logic could be implimented to fulfill this task?
includeTargets << grailsScript('Init') includeTargets << grailsScript('Compile') target(buildAll: 'build the taps-spock-extensions.jar') { depends(compile, buildJar) } target(buildJar: 'build the taps-spock-extensions.jar') { def libDir = new File((File)grailsSettings.baseDir, 'lib') def jarFile = new File(libDir, 'taps-spock-extensions.jar') def serviceType = 'org.spockframework.runtime.extension.IGlobalExtension' ant.delete(quiet: true, file: jarFile) ant.jar( destfile: jarFile ) { fileset(dir: classesDirPath) { include(name: '**/*ExecuteWhenPropertySet*.class') // 3 top classes + a couple closures include(name: '**/ReportConnectionLeaksExtension*.class') // top class & nested Listener } // Generate the serviceType file in META-INF/services, to plugin to Spock's ExtensionClassesLoader. service(type: serviceType) { provider(classname: 'edu.hawaii.its.taps.testing.OnlyExecuteWhenPropertySetExtension') provider(classname: 'edu.hawaii.its.taps.testing.ReportConnectionLeaksExtension') } } } setDefaultTarget( buildAll )
--
You received this message because you are subscribed to the Google Groups "Geb User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geb-user+u...@googlegroups.com.
To post to this group, send email to geb-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/399543de-5b08-4564-8ba7-8e58ce53fc4f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Geb User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geb-user+u...@googlegroups.com.
To post to this group, send email to geb-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/0c40445b-ae71-4e6d-8589-b2e009849e58%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to geb-user+unsubscribe@googlegroups.com.
To post to this group, send email to geb-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/0c40445b-ae71-4e6d-8589-b2e009849e58%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the Google Groups "Geb User Mailing List" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/geb-user/MHrMWvFa8EQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to geb-user+unsubscribe@googlegroups.com.
To post to this group, send email to geb-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/d3e67107-c4d0-2800-92a1-85e63f4d42a0%40getsu.com.