Forum Discussion

testlc's avatar
testlc
Occasional Contributor
11 years ago
Solved

create PDF report with groovy

Dear All,

Much appreciate if you could help me out,

I am trying to create PDF report via groovy from soapui pro after each security test run, i am using below scripts, I can see the result data in Xml, CSV exported but NOT in the pdf format, please do kindly help:-)

def tc = testRunner.testCase
def st = tc.getSecurityTestList()
def report = new SecurityTestCaseReport(st[0]) // st[0] is the security test case
def AvailableReports = ReportEngineRegistry.getAvailableReports( report ) // get list of all reports for test case
AvailableReports[1].generate( report.getModelItem().getSettings(), (String[])[ "CSV","XML" ], folder)
AvailableReports[0].generate( report.getModelItem().getSettings(), (String[])[ "PDF" ], folder)
AvailableReports[1].release()
AvailableReports[0].release()
  • ShikharSaxena's avatar
    ShikharSaxena
    8 years ago

    HI Rao,

     

    Problem got resolve after including below class

    import com.eviware.soapui.reporting.reports.security.*

     

    Thanks for your help

     

    cheers

    Shikhar

9 Replies

  • redfish4ktc2's avatar
    redfish4ktc2
    Super Contributor
    Hi, if you are using Soapui Pro, you should post in the pro forums to get support from SmartBear
  • ShikharSaxena's avatar
    ShikharSaxena
    Occasional Contributor

    Hi guys, I know its off topic now but need help on above topic ,While trying this I am getting below exception

     

    org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
    Script4.groovy: 8: unable to resolve class SecurityTestCaseReport
    @ line 8, column 14.
    def report = new SecurityTestCaseReport(st[0])
    ^
    org.codehaus.groovy.syntax.SyntaxException: unable to resolve class SecurityTestCaseReport
    @ line 8, column 14.
    at org.codehaus.groovy.ast.ClassCodeVisitorSupport.addError(ClassCodeVisitorSupport.java:148)
    at org.codehaus.groovy.control.ResolveVisitor.resolveOrFail(ResolveVisitor.java:229)
    at org.codehaus.groovy.control.ResolveVisitor.resolveOrFail(ResolveVisitor.java:239)
    at org.codehaus.groovy.control.ResolveVisitor.transformConstructorCallExpression(ResolveVisitor.java:1069)
    at org.codehaus.groovy.control.ResolveVisitor.transform(ResolveVisitor.java:754)
    at org.codehaus.groovy.control.ResolveVisitor.transformDeclarationExpression(ResolveVisitor.java:1110)
    at org.codehaus.groovy.control.ResolveVisitor.transform(ResolveVisitor.java:746)
    at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitExpressionStatement(ClassCodeExpressionTransformer.java:139)
    at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:40)
    at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:35)
    at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:165)
    at org.codehaus.groovy.control.ResolveVisitor.visitBlockStatement(ResolveVisitor.java:1337)
    at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:69)
    at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:101)
    at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:112)
    at org.codehaus.groovy.ast.ClassCodeExpressionTransformer.visitConstructorOrMethod(ClassCodeExpressionTransformer.java:50)
    at org.codehaus.groovy.control.ResolveVisitor.visitConstructorOrMethod(ResolveVisitor.java:173)
    at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:123)
    at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1056)

     

     

    Request to please tell me which jar or import statement required to resolve this problem

    • nmrao's avatar
      nmrao
      Champion Level 3
      Wild guess - try adding junit library to classpath.
      • ShikharSaxena's avatar
        ShikharSaxena
        Occasional Contributor

        HI Rao,

        Thanks for prompt reply ,

        but I am executing above code in groovy test step.

        Also when we use def report = new WsdlTestCaseReport(context.testCase) its execute without any error .

        but unfortunately not for def report = new SecurityTestCaseReport(st[0])

         

        Note : I  am using Pro version