Custom Report: getCovers() and getCoveringTestCases() - Klaros Test Management - Forum - Klaros-Testmanagement
Custom Report: getCovers() and getCoveringTestCases()
J Francisco Guardado, geändert vor 10 Jahren.
Custom Report: getCovers() and getCoveringTestCases()
Youngling Beiträge: 2 Beitrittsdatum: 30.07.14 Neueste Beiträge
Hi,
I organized testcases by linking them to requriments and now I want to do a report that presents those links using excel.
On implementing a custom report I found getCovers() and getCoveringTestCases() for TestCase and Requirement respectively to solve this, but they deliver internal representation of the objects.
Is there a way to translate or get the dynamic text of 'shortname' prior to passing the data to the render process, or better access them from the render process whlie it iterates. It seems to me actually that the renderer can deal with those methods but the result is only an empty list.
Example:
<e:column value="#{req.getCoveringTestCases()}" var="reqtc">
<f:facet name="header">
<e:cell value="Testcases" />
</f:facet>
<e:cell value="#{reqtc.shortname}" />
</e:column>
Thanks in advance.
I organized testcases by linking them to requriments and now I want to do a report that presents those links using excel.
On implementing a custom report I found getCovers() and getCoveringTestCases() for TestCase and Requirement respectively to solve this, but they deliver internal representation of the objects.
Is there a way to translate or get the dynamic text of 'shortname' prior to passing the data to the render process, or better access them from the render process whlie it iterates. It seems to me actually that the renderer can deal with those methods but the result is only an empty list.
Example:
<e:column value="#{req.getCoveringTestCases()}" var="reqtc">
<f:facet name="header">
<e:cell value="Testcases" />
</f:facet>
<e:cell value="#{reqtc.shortname}" />
</e:column>
Thanks in advance.
Torsten Stolpmann, geändert vor 10 Jahren.
RE: Custom Report: getCovers() and getCoveringTestCases()
Jedi Council Member Beiträge: 759 Beitrittsdatum: 12.02.09 Neueste Beiträge
Hi Francisco,
at a glance this looks like you are on the right track with your approach.
To my knowledge there really should be no need to extract the field values prior to rendering.
I think your problem is that #{req.getCoveringTestCases()} is returning a java.util.Set instead of a java.util.List which the underlying EL Implementation is unable use for iteration.
So changing #{req.getCoveringTestCases()} to #{req.getCoveringTestCases().toArray()} should give you the result you are looking for.
Please let me know if this works for you.
Regards,
Torsten
at a glance this looks like you are on the right track with your approach.
To my knowledge there really should be no need to extract the field values prior to rendering.
I think your problem is that #{req.getCoveringTestCases()} is returning a java.util.Set instead of a java.util.List which the underlying EL Implementation is unable use for iteration.
So changing #{req.getCoveringTestCases()} to #{req.getCoveringTestCases().toArray()} should give you the result you are looking for.
Please let me know if this works for you.
Regards,
Torsten
J Francisco Guardado, geändert vor 10 Jahren.
RE: Custom Report: getCovers() and getCoveringTestCases()
Youngling Beiträge: 2 Beitrittsdatum: 30.07.14 Neueste Beiträge
Torsten,
thanks for your reply.
Unfortunately, it did not work. I tried even using a separated worksheet passing the same context to it as in my previous try.
In this case I got an empty iteration for the cells.
Code:
<e:worksheet value="#{requirements}" var="req">
<e:column value="#{req.getCoveringTestCases().toArray()}" var="reqtc">
<f:facet name="header">
<e:cell value="Testcases" />
</f:facet>
<e:cell value="#{reqtc.shortname}" />
</e:column>
</e:worksheet>
It could be also seen that the element column is not able to parse the new value operation at all. With the line:
<e:column value="#{req.getCoveringTestCases().trray()}" var="reqtc">
I got an empty iteration too.
Regards
thanks for your reply.
Unfortunately, it did not work. I tried even using a separated worksheet passing the same context to it as in my previous try.
In this case I got an empty iteration for the cells.
Code:
<e:worksheet value="#{requirements}" var="req">
<e:column value="#{req.getCoveringTestCases().toArray()}" var="reqtc">
<f:facet name="header">
<e:cell value="Testcases" />
</f:facet>
<e:cell value="#{reqtc.shortname}" />
</e:column>
</e:worksheet>
It could be also seen that the element column is not able to parse the new value operation at all. With the line:
<e:column value="#{req.getCoveringTestCases().trray()}" var="reqtc">
I got an empty iteration too.
Regards
Torsten Stolpmann, geändert vor 10 Jahren.
RE: Custom Report: getCovers() and getCoveringTestCases()
Jedi Council Member Beiträge: 759 Beitrittsdatum: 12.02.09 Neueste Beiträge
Hi Francisco,
you are right in that the underlying framework (seam-excel/jexcelapi) does not support the nesting of both worksheet and column iterations.
A working (yet cumbersome) solution would be the following and relies on loop unrolling:
Sorry, but there is other solution at hand for this output format.
Regards,
Torsten
you are right in that the underlying framework (seam-excel/jexcelapi) does not support the nesting of both worksheet and column iterations.
A working (yet cumbersome) solution would be the following and relies on loop unrolling:
<e:workbook xmlns:e="http://jboss.org/schema/seam/excel" xmlns:ui="http://java.sun.com/jsf/facelets" | |
xmlns:f="http://java.sun.com/jsf/core"> | |
<e:worksheet value="#{requirements}" var="req" varStatus="reqStat"> | |
<e:column> | |
<f:facet name="header"> | |
<e:cell value="Requirement" /> | |
</f:facet> | |
<e:cell value="#{req.shortname}" /> | |
</e:column> | |
<e:column> | |
<f:facet name="header"> | |
<e:cell value="Testcase" /> | |
</f:facet> | |
<e:cell value="#{req.getCoveringTestCases().toArray()[0].getShortname()}" /> | |
</e:column> | |
<e:column> | |
<f:facet name="header"> | |
<e:cell value="Testcase" /> | |
</f:facet> | |
<e:cell value="#{req.getCoveringTestCases().toArray()[1].getShortname()}" /> | |
</e:column> | |
<!-- repeat columns as needed --> | |
</e:worksheet> | |
</e:workbook> |
Sorry, but there is other solution at hand for this output format.
Regards,
Torsten