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
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à
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.
A way too simple Spring 2.5 web application to show how to use OpenSessionInViewFilter together with Hibernate.
Integration Test with Maven
A collection of posts found on the internet focusing on how to tweak/enhance Maven to perform integration tests.
- Integration testing with maven 2.0 – by Julien Dechmann
- Getting Coverage For Integration Tests – by Ulrik Sandberg
- Integration tests with Maven (Part 1): Failsafe Plugin – by velo
- Unit tests are not integration tests – by John Ferguson Smart
- Maven Integration Testing – by Rod Coffin
- Maven and Integration Testing – from codehaus
[WARNING] File encoding has not been set
Saw this warning message when using failsafe maven plugin, found the fix after a little search.
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
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
Developing Spring Web Flow 2 Application
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.
As part of “Developing Spring Web Flow 2 Application” series, this post shows some application details and reference document.
As part of “Developing Spring Web Flow 2 Application” series, this post shows the following features:
- Persistence