Exception, java.lang.NullPointerException, Services Testing, SoapUI, System Testing, Test Cases, Test Steps, Testing, Web Services

java.lang.NullPointerException at com.eviware.soapui.reporting.engine.export.XmlExporter.export

Hi all, its been a month I am working on SoapUI and I started writing blogs on SoapUI. From today onwards I will share the hiccups I have faced while working with SoapUI along with the tutorials chain. So lets get started with an unusual error which some of SoapUI users have faced and many may have not seen.

12:21:18,933 INFO [SoapUIProTestCaseRunner] Project [CDI-Functional-Tests] finished with status [FINISHED] in 5943ms
<strong>java.lang.NullPointerException</strong>
at com.eviware.soapui.reporting.engine.export.XmlExporter.export(SourceFile:21)
at com.eviware.soapui.reporting.engine.export.ExportReportEngine$GeneratableExportReport.generate(SourceFile:111)
at com.eviware.soapui.SoapUIProTestCaseRunner.generateReports(SourceFile:230)
at com.eviware.soapui.SoapUIProTestCaseRunner.runProject(SourceFile:209)
at com.eviware.soapui.tools.SoapUITestCaseRunner.runRunner(SoapUITestCaseRunner.java:407)
at com.eviware.soapui.tools.AbstractSoapUIRunner.run(AbstractSoapUIRunner.java:158)
at com.eviware.soapui.maven2.TestMojo.execute(TestMojo.java:119)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
12:21:19,610 INFO [SoapUIProTestCaseRunner] Created report at file: /integration-tests/soapui-cdi-integration-test
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ soapui-integration-test ---
[INFO] Installing integration-tests\soapui-integration-test\target\soapui-integration-test-1.0-SNAPSHOT.j
[INFO] Installing integration-tests\soapui-cdi-integration-test\pom.xml to C:\Users\user\.m2\repository\com\hi\cf
[INFO] ------------------------------------------------------------------------
[INFO]<strong> BUILD SUCCESS</strong>
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.702s
[INFO] Finished at: Mon Aug 11 12:21:21 IST 2014
[INFO] Final Memory: 52M/623M</code></blockquote>

SoapUI tool is common though not-so-user friendly I would say. One have to dig into the tutorials provided by soapui.org for understanding the User Interface of SoapUI . Although first being the basics like what is SOA , SOAP , REST ,etc.

Before reading this blog I would suggest you all to read my previous blogs to get a quick start.
Ingredients :

Soap Ui project type : Maven based project integrated with jenkins.

Build tool used : Maven

Reporting tool : Sure fire report- HTML based

Continuous Integration : Jenkins

Problem Statement :

In project pom ,I have added a configuration such that the reports will come in XML file.

<configuration>
<projectFile>${basedir}/src/test/java/com/hi/cdi/soapui-project</projectFile>;
<outputFolder>${project.build.directory}/surefire-reports</outputFolder>
<!--Make the jUnit results file-->
<junitReport&gt;true&lt;/junitRepor>
<!-- Print small report to the console -->
<printreport&gt;true&lt;/printreport>
<reportName&gt;Data Export&lt;/reportName>
<reportFormat>XML</reportFormat>

Root Cause Analysis

When I try running my soapUI tests from local then null pointer error was coming and when same tests are running on Jenkins machine then no error used to come.

What is the cause?

The issue is that the reportFormat has been defined in XML format and at local it requires some dependency to change the format from normal HTML format to XML format.

But, the good part is ,it does not need any fix as such . And this is not a blocker. So all you should know is why it is coming. Along with this you should get a report in the desired format you want.

If you are getting a message like this:

12:21:19,610 INFO [SoapUIProTestCaseRunner] Created report at file: /integration-tests/soapui-integration-test/{Project-location}.

Then nothing to worry about, you need to just check the location and see if in the above(or the location which your command line says) should have a report in XML format. Again for me the issue is coming only on my local and that too is providing me reports so I  just ignored this error. And via Jenkins it provides me beautiful reports.

Conclusion

  1. When you encounter errors like this just try to analyse from where the error can come.
  2. Is is actually an error or just a warning.
  3. Last but not the least do check the path or location which the error is showing in the console and see if the path has actually the reports in it.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s