Skip to content

Configure Ant Task for Running SoapUI as JUnit Test

01/18/2012

There have been some blog posts regarding running SoapUI using either testrunner.bat or testrunner.sh scripts coming with SoapUI installation. You can choose either bat or sh script based on your OS. But what if I need a solution that works on both Windows and Linux? There  are also posts mentioning reading the SoapUI project file and creating custom JUnit test class to run each test case inside test suite. Is there another way ?

What “testrunner” does is simply to run a Java program (with com.eviware.soapui.tools.SoapUITestCaseRunner as Main class) and generates JUnit reports.  What we can do is to configure an Ant task running the very same Java class with the same configurations.



Ant Task Configuration

Ant target configuration

After running this target, JUnit reports will be generated in the pre-defined directory. If you are using CI server (such as Bamboo), since build plan is configured to look for JUnit results, in the email sent out by Bamboo after each build you can see which test case failed if any.    Voilà

Configure Clover and Sonar Ant Tasks for Code Coverage

01/18/2012
tags: , ,

Using Cobertura or Clover to generate code coverage reports is a relatively straightforward task as there have been some examples out there to begin with. On the other hand, being able to see coverage number generated by Clover in Sonar console takes a little bit extra configuration as Sonar by default is using Cobertura as code coverage plugin.

Ant Tasks Configuration

Sonar Ant target configuration(with dynamic analysis)

Sonar Ant target configuration(with reuseReports)

Clover Ant target configuration

Ant Command

ant   with.clover   test   clover.report   sonar

(test target is the one to compile source code and run JUnit test, replace it with your own one)

Sonar Server Configuration

There was something I have been missing and kept me from seeing the code coverage number showing up in Sonar console after running the above mentioned Ant command. Despite already setting ”sonar.core.codeCoveragePlugin” property to “clover”, I was still not able to see the coverage number. It turned out that the answer is right there in the Sonar Clover Plugin instruction.

What I was missing is adding Sonar Clover Plugin jar file into Sonar core-plugins directory.

sonar-2.12/lib/core-plugins/sonar-clover-plugin-2.8.jar

It is also important to configure Sonar’s Global or Project settings to specify using “clover” as code coverage plugin.

Using OpenSessionInViewFilter in Spring Web Application

10/10/2009

A way too simple Spring 2.5 web application to show how to use OpenSessionInViewFilter together with Hibernate.

Read more…

Integration Test with Maven

06/25/2009
tags:

A collection of posts found on the internet focusing on how to tweak/enhance Maven to perform integration tests.

  1. Integration testing with maven 2.0 – by Julien Dechmann
  2. Getting Coverage For Integration Tests – by Ulrik Sandberg
  3. Integration tests with Maven (Part 1): Failsafe Plugin – by velo
  4. Unit tests are not integration tests – by John Ferguson Smart
  5. Maven Integration Testing – by Rod Coffin
  6. Maven and Integration Testing – from codehaus


Read more…

[WARNING] File encoding has not been set

06/24/2009
tags:
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!


Saw this warning message when using failsafe maven plugin, found the fix after a little search.

Read more…

Developing Spring MVC application – Annotation based Controller and JPA

06/20/2009

This application is based on the sample Spring MVC application described in the “Developing a Spring Framework MVC application step-by-step” document in the Spring Framework 2.5 download. The differences are

  • Annotation based Controller class
  • JPA based persistence using Hibernate
  • Maven based project configuration
  • Test classes are upgraded to use JUnit 4 annotation


Read more…

Spring MVC – Resolving Locale and Externalizing Locale-Sensitive Text Messages

06/16/2009

A sample Spring MVC application to show how to

  • Retrieve the current Locale Resolver
  • Retrieve the current Locale
  • Set a new Locale
  • Display different version of the same message for different locales

Read more…

Developing Spring Web Flow 2 Application

06/06/2009

This is a series of posts about developing a Shopping Cart web application using Spring Web Flow 2. It is not intended to be a step by step tutorial of how to develop a Spring Web Flow application but rather to show some of the key features and implementation ideas of a Spring Web Flow application.

Read more…

Developing Spring Web Flow 2 Application part 6 – Misc and References

06/01/2009

As part of “Developing Spring Web Flow 2 Application” series, this post shows some application details and reference document.

Read more…

Developing Spring Web Flow 2 Application part 5 – Persistence

05/27/2009

As part of “Developing Spring Web Flow 2 Application” series, this post shows the following features:

  • Persistence

Read more…

Follow

Get every new post delivered to your Inbox.