Logback Console in Eclipse

Recently i did find there is a console plugin for logback in eclipse. Unfortunately its based on a very old version of logback (0.9.9), so i searched for the sources, bumped the logback/slf4j versions to 0.9.28 and 1.6.1 and fixed various things in the plugin. Now there’s a new version of this plugin available here, i’ll post the sources to github soon.

This version is compiled with jdk 1.6 and has eclipse 3.6 as target platform. If you’ll need something else, drop a comment ..

The documentation at http://logback.qos.ch/consolePlugin.html is still valid, just unzip the file in your plugins folder and select the logback view. After you did configure logback to use the console in logback(-test).xml things should start to show up in eclipse.
The neat thing is, that you can click on each logentry in the console to see where that specific logentry was created. Like linked stacktraces but for logfile enties.

*Update* Version 1.1.2 fixes an overlooked bug while viewing a stacktrace: logback eclipse Plugin 1.1.2

Posted in java, logging | Tagged , , , | 2 Comments

Running SoapUI Integration Tests in Hudson

Recently i’ve been wondering how to automate webservice(SOAP) integration tests. My first idea was to use soamoa, but it seems a bit buggy at the moment and the last version seems quite a while ago.

But SoapUI does offer a native maven plugin, which can run SoapUI testcases directly. So I set up a small maven project, and add a soapUI testcase like this:

<build>
 <plugins>
   <plugin>
     <groupId>eviware</groupId>
     <artifactId>maven-soapui-plugin</artifactId>
     <version>3.6.1</version>
     <executions>
       <execution>
         <id>SoapUITest1</id>
         <configuration>
           <projectFile>src/test/soapui/SoapUITest1-project.xml</projectFile>
           <outputFolder>${project.build.directory}/surefire-reports</outputFolder>
           <junitReport>true</junitReport>
           <exportAll>true</exportAll>
           <printReport>false</printReport>
         </configuration>
         <goals>
           <goal>test</goal>
         </goals>
         <phase>test</phase>
       </execution>
     </executions>
    </plugin>
  </plugins>
 </build>

Now, when i run “mvn test” from the command line, everything looks fine and the tests get correctly executed. But after I import the project in Hudson, i can’t see the test results :( This seems to be a bug in Hudson, the only workaround at this point seems to create a freeform project in hudson instead of a maven2 one, add a maven2 step (mvn test), then add “**/target/surefire-reports/*.xml” under “Publish junit test results”. Now Hudson correctly does display all test results on the project page.

The only point left is to run multiple SoapUI projects from one maven project, for this one needs to add multiple <execution> tags, maybe the future versions of the soapui-maven-plugin will support easier configuration.

Continuous Integration mit Hudson: Grundlagen und Praxiswissen für Einsteiger und Umsteiger Webservice-Programmierung mit SOAP SOA in der Praxis: System-Design für verteilte Geschäftsprozesse

Posted in java, Testing | Tagged , , , | Leave a comment

Running selenium-hub inside Tomcat

The usual process of starting selenium-hub seems to be an ant goal that does run an integrated jetty server. While this is easy to run it is not so easy to run in a server enviromnent. Also, as i have an existing tomcat already running and the hub does not do that much i was wondering if i can run the server inside tomcat.

The first look was dissapointing, everything is bundeled in jar files, no war file in sight. Fortunately selenium-hub is just a bunch of servlets with some logic behind, so it should be easy to add some maven scripts to create a war file.

Selenium-hub also depends on selenium-core, which is also included in the selenium-hub distribution. So i created a fork of selenium-grid on github and add some maven scripts. You can see the results here: https://github.com/mglauche/selenium-grid . Right now only the core and the hub part are mavenized.

A complete war-file can be found here: selenium-core-hub-1.0.8-SNAPSHOT

Selenium. Web-Applikationen automatisiert testen

Handbuch zum Testen von Web-Applikationen: Testverfahren, Werkzeuge, Praxistipps (Xpert.Press)

Posted in Testing | Tagged , , | Leave a comment

Introduction to Scala – Part 1

What is scala ?

Scala is a relativ new compiled programming language that takes a lot of ideas from python, ruby and others. From the scala homepage:

Scala is a general purpose programming language designed to express common programming patterns in a concise, elegant, and type-safe way. It smoothly integrates features of object-oriented and functional languages, enabling Java and other programmers to be more productive. Code sizes are typically reduced by a factor of two to three when compared to an equivalent Java application.

Why do we need another programming language ?

I mean, there are a wealth of different languages that created quite a buzz recently like ruby, python, c#. Why do you need scala ? For one, scala is a compliled language unlike ruby and python. The scala compliler generates java-bytecode that is compatible with the java jre.
This looks like a small feature but it is really one of the most interesting features of scala:

Seamles Integration in java

You can directly use java objects in scala and vice versa. Scala directly compiles to java .class files. You can deploy scala applications to your J2EE container. Which means if you are a java shop you can use your existing tools and servers to deploy scala applications. No need for a new application server, JBoss, websphere and others will work fine.

This is a very important point for larger companies. Changes in these companies can only happen graduately, so you can keep your existing knowledge and workers. The server administrators still only need to maintain the same application server they’ve been knowing for years. You even can continue to use your own libraries you’ve developed in java over the years. These points are very important if you want to make a successfull migration towards scala.

Why use Scala over Java ?

If scala is fully compatible with java, why use it ? Why learn a new language when the old one seems good enough ?

  • Scala corrects many of javas mistakes
    • Everything is an Object in scala
    • Type inference -> only need to declare the type on the right side of the assignment (i.e. var dummy= Map[String,Int]() )
    • True Mixins
    • Scala is both, a object oriented and a functional programming language
  • Fresh start
    • Clean Language, nothing feels like an addon (like generics for example)
    • much more compact, like no need for getters and setters
    • No semicolons

Hello World in scala

Enough of the theory. How does a typical scala program look like ?

object HelloWorld {
  def main(args: Array[String]) {
    println("Hello, world!")
  }
}

Programmieren mit Scala Grundkurs funktionale Programmierung mit Scala Scala: Der Schnelleinstieg für Entwickler (Galileo Computing)
Posted in scala | Tagged , , | Leave a comment