Issue with custom extension for @Ignore annotation

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Issue with custom extension for @Ignore annotation

will.lucas2
We've implemented annotation extensions successfully but cannot get the over-ridden @Ignore to execute when the 
Despite field features.skipped=true at org.spockframework.runtime.model.SpecInfo and the related Interceptor, the test is still being executed.
What is stomping on it or where in the stack should I begin looking?

Snippet: (NOTE: 'status' being set correctly and it.setSkipped(true) gets called.  When returning control to spockframework.runtime, at some point, it is set to false.

public HandleStatus(def invocation, ArrayList<FeatureInfo> features){
def knownIssueExtension = invocation.getInstance().metaClass.getProperties().find { it.name == "knownIssueExtension"}.getProperty(invocation.getInstance())
if (knownIssueExtension == null){
throw new Exception("You must set the @shared knownIssueExtension property to an instance of a class " +
"that extends KnownIssueExtension and implements 'DefectStatus getDefectStatus(String defectId)'.")
}

DefectStatus status = null
try {
status = knownIssueExtension.getDefectStatus(id)
} catch (Exception ex) {
LOGGER.warn("Unable to determine defect status for defect ID '{}', test case or class {}, error message {}\r\n{}", id, testOrClassName, ex.message, ex.stackTrace)
// If we can't get info from Defect repository, just skip it, it should not cause failures or cause us not to execute tests.
}
if (status != null) {
if (!status.open && !status.fixed) {
LOGGER.error("Defect with ID '{}' and title '{}' is no longer in an open status and is not fixed, for test case or class '{}'. Update tests.", id, status.defectTitle, testOrClassName)
features.each {
it.addInterceptor(new CauseFailureInterceptor(new KnownIssueException("Defect with ID '" + id + "' and title '" + status.defectTitle + "' is no longer in an open status and is not fixed, for test case or class '" + testOrClassName + "'. Update test cases.")))
}
} else if (status.open && !status.fixed) {
LOGGER.warn("Defect with ID '{}' and title '{}' is still open and has not been fixed for test case or class '{}'. Not executing tests.", id, status.defectTitle, testOrClassName)
features.each {
it.setSkipped(true)
}

--
You received this message because you are subscribed to the Google Groups "Spock Framework - User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/spockframework.
For more options, visit https://groups.google.com/d/optout.
Loading...