Showing posts with label MAVEN. Show all posts
Showing posts with label MAVEN. Show all posts

Thursday, 13 November 2014

SOA Testing in Maven

Currently there are few tools that can support testing SOAP interfaces.

For instance Jmeter and SoapUI are suited for testing soap interfaces.

  • SoapUI is explicitly created for testing SOAP interfaces
  • Jmeter has a SOAP support since version 2.3.x. 


SoapUI, has an intuitive user interface and is flexible.
You can run SoapUI stand alone and it can be to integrated within an automated process.

Below you will find instructions for running SoapUI as a part of a maven build. This makes it possible to run your automated SOAP tests in Maven with a build process like Jenkins. Combined with automatic deployment it is possible to support an agile software development process that supports frequent delivery of versions and continuous integration and testing.

Maven2 supports SoapUI with the Maven SoapUI plugin.

Usage:

Add the eviware plugin repository to your repository list.

 
<pluginRepositories>
  <pluginRepository>
    <id>eviwarePluginRepository</id>
    <url>http://www.eviware.com/repository/maven2/</url>
  </pluginRepository>
</pluginRepositories>


Attach to verify phase

By attaching the SoapUI maven plugin to the verify phase your build process runs it automatically in the integration-test phase. The “iso-soapui-project.xml” is the reference to the SoapUI xml file.

 
<plugin>
  <groupId>eviware</groupId>
  <artifactId>maven-soapui-plugin</artifactId>
  <version>2.0.2</version>
  <executions>
    <execution>
      <phase>verify</phase>
      <id>soapui-tests</id>
      <configuration>
        <projectFile>${basedir}/src/test/soapui/iso-soapui-project.xml</projectFile>
        <outputFolder>${basedir}/target/soapui</outputFolder>
        <junitReport>true</junitReport>
        <exportwAll>true</exportwAll>
        <printReport>false</printReport>
      </configuration>
      <goals>
        <goal>test</goal>
      </goals>
    </execution>
  </executions>
</plugin>



Convert log to a report

The log export of SoapUI can be interpreted like a normal Surefire unit report. By just adding this part to your maven reports section you can generate a nice overview of your test results.

 
<reporting>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-report-plugin</artifactId>
      <configuration>
         <outputDirectory>target/site/soapui</outputDirectory>
         <reportsDirectories>
           <reportsDirectories>target/soapui/</reportsDirectories>
         </reportsDirectories>
      </configuration>
    </plugin>
  </plugins>
</reporting>




Thanks to the AMIS blog for this information!!!

Saturday, 22 February 2014

Maven Jdeveloper plugin

If you work with Maven and Jdeveloper 11 this plugin is a MUST for you.
Just add to your POM the following:

      <plugin>
        <groupId>org.apache.myfaces.trinidadbuild</groupId>
        <artifactId>maven-jdev-plugin</artifactId>
        <version>1.2.6</version>
      </plugin>


Then run:

mvn jdev:jdev

and magically Maven it will create the Jdeveloper PRJ file with all the library needed!!!

Maven and Archiva setup

Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central place.
I've found Maven very useful in many situation, for example for building up a project downloaded from internet and compile it straight away. With Maven it takes 2 minutes only!!!

Here a brief guide about how to setup Maven+Archiva


Maven Installation

1. Download Maven 2.2.1 Maven Download

2. Unpack the archive where you would like to store the binaries. A directory called "apache-maven-2.x.y" will be created.

3. Add the bin directory to your PATH, eg:

      set PATH="c:\apache-maven-2.x.y\bin";%PATH%

4. Make sure JAVA_HOME is set to the location of your JDK

5. Run "mvn --version" to verify that it is correctly installed.


Archiva Installation

1. The quickest way to install Archiva is to download archiva standalone and use this distribution. This includes a bundled Jetty server which can be easily started.

2. Unpack the archive where you would like to store the binaries. A directory called "apache-archiva-2.x.y" will be created.

3. Archiva can be run by executing, bin/archiva, or bin\archiva.bat for Windows (select the one for your environment). The argument can be console to run interactively, or start to run in the background (in this case, run the script with stop to later stop the server). The logs are available in the logs directory where Archiva is installed.

Maven Configuration

Maven configuration occurs at 3 levels:

-Project - most static configuration occurs in pom.xml
-Installation - this is configuration added once for a Maven installation
-User - this is configuration specific to a particular user (${user.home}/.m2/settings.xml)

The separation is quite clear - the project defines information that applies to the project, no matter who is building it, while the others both define settings for the current environment.

The localRepository is the path to the local repository maven will use to store artifacts. It has to be configured using a local folder like here:

<localRepository>C:\apache-maven\localRepo</localRepository>

Repositories are declared inside a project, which means that if you have your own custom repositories, those sharing your project easily get the right settings out of the box. However, you may want to use an alternative mirror for a particular repository without changing the project files.

If you would like Archiva to serve as the only repository used by your Maven installation, you can use the Maven mirror settings to force this behaviour.
First, you need to select the default repository to use when none is configured by adding the following to the settings.xml file:


  
  <mirrors>
    <mirror>
      <id>archiva.default</id>
      <url>http://repo.mycompany.com:8080/repository/internal/</url>
      <mirrorOf>external:*</mirrorOf>
    </mirror>
  </mirrors>

Archiva Configurations

You can now browse the web administration of Archiva. There will be a few basic setup tasks to get started.

The first step is to setup your administration user. The password requires a numerical character and must not be longer than 8 chars. You'll then need to log in. Use 'admin' as the username and the password you've entered.

At this point, Archiva is fully functional - you can use it with the default repositories and guest user. You might like to explore the user and administrator guides to find other functionality.

The default configuration for Archiva configures two repositories:

  • internal - a repository for containing released artifacts. This is connected by proxy to the central repository, so requests here will automatically retrieve the remote artifacts.
  • snapshots - a repository for storing deployed snapshots. This is not proxied to any remote repositories by default.
In addition, the guest user has read access to these repositories, so you can make anonymous requests to either. To try this out, point a web browser at the following URL: http://localhost:8080/repository/internal/junit/junit/3.8.1/junit-3.8.1.jar. Though the artifact is not present locally, you will see in the Archiva logs that it is downloaded from the central repository, and then handed back to the browser and downloaded from Archiva. Future requests for the artifact will be much faster as they need not be downloaded from the central repository