Forum Discussion

JGibson's avatar
JGibson
Occasional Contributor
12 years ago

[Closed] Reporting using Datasinks

I've followed the page about this topic,
http://soapui.org/Reporting/using-the-s ... asink.html
and I'm finding it insufficient explanation. I've tried replicating its instructions, changing names to suit my situation, and ended up with errors. I need help!
More specifics:
I'm using the subreport mode of Datasink, and just drawing properties from a datasource. Within the Datasink editor, that seem to work fine.
Since I'm looking to create a printable report, I followed the instructions in that section, making a testcase report and subreport, copy-pasted your xml (then painstakingly put in linebreaks so I could read it), changed the names of things to fit. I've been trying to find the sources of my errors, and so ended up deleting most things that seemed extraneous, to get to just the minimal working code. Possibly I've deleted something important.
The error I'm getting now is: "ERROR:An error occured [Error loading object from URL : subreport:OurTestCase], see error log for details".
---------------Error Log:
Tue Oct 09 14:09:12 EDT 2012:ERROR:net.sf.jasperreports.engine.JRException: Error loading object from URL : subreport:OurTestCase
net.sf.jasperreports.engine.JRException: Error loading object from URL : subreport:OurTestCase
at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:154)
at net.sf.jasperreports.engine.util.JRLoader.loadObjectFromLocation(JRLoader.java:247)
at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluateReport(JRFillSubreport.java:301)
at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluateSubreport(JRFillSubreport.java:327)
at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluate(JRFillSubreport.java:263)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:258)
at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:499)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2036)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:760)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:270)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:128)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:946)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:864)
at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:84)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:624)
at com.eviware.soapui.reporting.engine.jasper.GenerateJasperReport.createReport(SourceFile:467)
at com.eviware.soapui.reporting.engine.jasper.GenerateJasperReport$ReportFillWorker.construct(SourceFile:428)
at com.eviware.soapui.support.swing.SwingWorkerDelegator.construct(SwingWorkerDelegator.java:46)
at com.eviware.soapui.support.swing.SwingWorker$2.run(SwingWorker.java:149)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2280)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2749)
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:779)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:279)
at net.sf.jasperreports.engine.util.ContextClassLoaderObjectInputStream.<init>(ContextClassLoaderObjectInputStream.java:53)
at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:149)
... 19 more

-----------------
The Report xml: "OurTestCase Report"
<jasperReport xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="OurTestCaseReport" language="groovy" pageWidth="595" pageHeight="842" columnWidth="535" leftMargin="30" rightMargin="30" topMargin="30" bottomMargin="30" xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<property name="ireport.encoding" value="UTF-8"/>
<template>"../../styles.jrtx"</template>

<parameter name="HeaderLogo" class="java.lang.String" isForPrompting="false">
<defaultValueExpression>"../../logos/header_logo.jpg"</defaultValueExpression>
</parameter>
<pageHeader>
<band height="51">
<printWhenExpression>$V{PAGE_NUMBER} == 1</printWhenExpression>
<image scaleImage="Clip" hAlign="Right" isUsingCache="false" onErrorType="Blank">
<reportElement x="0" y="0" width="535" height="51"/>
<imageExpression class="java.lang.String">$P{HeaderLogo}</imageExpression>
</image>
</band>
</pageHeader>
<columnHeader>
<band height="77">
<printWhenExpression>$V{PAGE_NUMBER} == 1</printWhenExpression>
<staticText>
<reportElement style="MainHeader" x="0" y="0" width="535" height="35"/>
<textElement/>
<text>TestCase Results Report for</text>
</staticText>
<textField isStretchWithOverflow="true">
<reportElement style="MainHeader" x="0" y="35" width="535" height="40"/>
<textElement/>
<textFieldExpression class="java.lang.String">"${=testCase.name}"</textFieldExpression>
</textField>
</band>
</columnHeader>
<detail>
<band height="281">
<subreport>
<reportElement positionType="Float" isPrintRepeatedValues="false" x="0" y="31" width="535" height="30" isRemoveLineWhenBlank="true"/>
<dataSourceExpression>$P{DataSink}</dataSourceExpression>
<subreportExpression class="java.lang.String">"subreport:OurTestCase"</subreportExpression>
</subreport>
</band>
</detail>
</jasperReport>

---------------------------
The subreport xml: "OurTestCase"
<jasperReport xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="jNetrixTestCase" language="groovy" pageWidth="535" pageHeight="842" columnWidth="535" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">  
<template>"../../styles.jrtx"</template>
<field name="TestName" class="java.lang.String"/>
<field name="ExpectedCode" class="java.lang.Int"/>
<columnHeader>
<band height="59">

<staticText>
<reportElement style="ColumnHeader" x="183" y="35" width="74" height="20"/>
<textElement textAlignment="Left" verticalAlignment="Middle"/>
<text>Test</text>
</staticText>
<staticText>
<reportElement style="ColumnHeader" x="265" y="35" width="200" height="20"/>
<textElement textAlignment="Left" verticalAlignment="Middle"/>
<text>Expected</text>
</staticText>
</band>
</columnHeader>
<detail>
<band height="21">
<textField isBlankWhenNull="true">
<reportElement x="183" y="1" width="74" height="20"/>
<textElement textAlignment="Left" verticalAlignment="Top"/>
<textFieldExpression class="java.lang.String">$F{TestName}</textFieldExpression>
</textField>
<textField isStretchWithOverflow="true">
<reportElement x="265" y="1" width="200" height="20"/>
<textElement textAlignment="Left" verticalAlignment="Top"/>
<textFieldExpression class="java.lang.String">$F{ExpectedCode}</textFieldExpression>
</textField>
</band>
</detail>
</jasperReport>

-------------------------
Any pointers would be much appreciated. Also, if there is documentation around that would help me, I'd love to have a better reference for what can be done, and the syntax to do it.

2 Replies

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    hmm.. could you attach (or send us) your soapUI project containing this TestCase and the custom report so we can try to figure out why it isn't working?

    thanks,

    /Ole
    SmartBear Software
  • JGibson's avatar
    JGibson
    Occasional Contributor
    oh, sorry, I seem to have missed that this post was answered. Unfortunately, I'm no longer focused on reporting, so I don't have the project in that state anymore. Likely I'll come back around to working on reports at some time, and revisit this.
    Sorry to have left this hanging!