Looking some more into it, it doesn't seem as simple as I thought:
When implementing CaseResult this indeed seems to have been intended to be JUnit only. This is illustrated by the Javadoc in the abstract superclass and by the existence of SimpleCaseResult, which seems to be language/test-framework independent (but seemingly not used anywhere).
So that's one dimension of the inheritance tree under TestResult: language/test-framework specialization
However, there's a second dimension, which I'd call scope of the test: hudson.tasks.junit.TestResult -> PackageResult/SuiteResult -> ClassResult -> CaseResult
and in that dimension CaseResult is the smallest unit of a test suite, so probably that what getFailedTests() should return.
 
So, currently we have no way to express: 'give me the smallest unit of test results, but without language/framework bonds"
 
It looks to me like this was implemented with best intentions - i.e. keeping it test-framework independent - but no one has ever added a non-JUnit implementation, so all plugins will probably only work with the JUnit implementations.
 
 
Gesendet: Mittwoch, 10. Juli 2013 um 09:51 Uhr
Von: "Christoph Kutzinski" <[email protected]>
An: [email protected]
Betreff: Aw: AbstractTestResultAction is not generic
Hi Nalin,
 
nice to know that you are working on even better integration of the TestNG plugin. You know that I had opened some JIRA issues against the plugin, going in that direction ;-)
 
As for your question:
I don't think CaseResult should be considered JUnit-only. It's probably historically that this class is in an junit package. If you need to add anything to CaseResult to make it usable with the TestNG plugin, I think that would be a way to go.
 
Regarding public List<hudson.tasks.junit.CaseResult> getFailedTests():
What this methods seems to want to do IMO, is to return the 'bottom-level' test failures (the actual individual tests) and that's CaseResult. So generifying the method with T wouldn't help in this case.
 
So the options are IMHO:
- amend CaseResult so it's usable for you
- make CaseResult non-final so you can extend it (actually: why do you this this is more 'messy'?)
 
cheers
Christoph
 
Gesendet: Mittwoch, 10. Juli 2013 um 08:42 Uhr
Von: Nalin <[email protected]>
An: [email protected]
Cc: Slide <[email protected]>, "Kawaguchi Kohsuke" <[email protected]>, "Christoph Kutzinski" <[email protected]>
Betreff: AbstractTestResultAction is not generic
Hi,
 
I am the maintainer for TestNG plugin for Jenkins. I have been trying to figure out how to get email-ext plugin to support reporting on test failures reported as part of TestNG reports.
 
The problem stems from the fact that AbstractTestResultAction is supposed to be a generic class but it contains a method:
 
    public List<hudson.tasks.junit.CaseResult> getFailedTests() {
        return Collections.emptyList();
    }
 
which returns CaseResult objects which are specific to JUnit. Also, CaseResult class is final and hence can't be extended.
 
TestNG plugin generates test result objects that extend hudson.tasks.test.TestResult but Email-ext and other plugins use the getFailedTests() methods and expect a list of CaseResult and then invoke specific methods on CaseResult object like getStatus, getClassname, getDisplayName etc. 
 
In light of this, how can we have plugins like email-ext support results from test reporting plugins other than the one built into Jenkins core?
 
1. Can we break backward compatibility and change the signature of getFailedTests() to return a List<hudson.tasks.test.TestResult> instead?
2. Should we make things more messy by making CaseResult non-final?
3. Is there something I can do with TestNG plugin to solve this issue?
4. Any other solution?
 
I would really like to make TestNG plugin as useful as possible and frankly it's missing a big functionality if jobs can't be configured to email report on failed test details.
 
Please advise.
 
 
Thanks,
Nalin
 
 

 

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.
 
 

 

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply via email to