HTTP Header Sniffer

If you are interested in the headers of your HTTP Requests (and you should be interested), it is often hard to find the right tool for the job. On Windows I used Fiddler, which works well for IE and Chrome, but needs a proxy entry to work with Firefox. A commercial but also very nice tool is HttpDebuggerPro, which has a good interface and filters.

I have switched to the Mac and was searching for a good tool. Live HTTP Headers is a Firefox Plugin but I don’t really liked it. Installed it today and the interface could be used for three requests, but has no overview for a lot of requests. With a search in the Firefox Add-Ons I found HttpFox. It is exactly the tool I searched for. I nice table with all requests and a split panel of the bottom for request and response headers.

Have a look at the screenshot and install it – as soon as possible. Why?

Bookmark and Share

Perfect Selenium Setup

It takes some time, but I’m now nearly happy with our Selenium setup. In this series I want to explain what goals existed and how we get a larger suite of Selenium tests running.

You can find some posts around Selenium in this blog, but I want to get in more detail. Also there are some improvements to the solutions which could be really interesting if you start with Selenium or get an idea, how others deal with larger Selenium test suites. I will try to publish a new part every week, because there is so much to say, which wouldn’t fit into one single post.

Goals:

  • Continuous integration of web application tests
  • Tests in different browsers
  • TestNG Setup
  • Integration in Maven2
  • Faster Selenium tests

Tests:

  • Running use cases of the web application
  • Running Javascript Unit Tests in different browsers
  • Take screenshots of the application

I’m a web developer and no full-time tester, that’s why you should see the posts as support in an agile environment. There are different solutions and methods to test a web application, but I feel very comfortable with coding my tests and provide solutions which helps in the day-to-day work.

Until I will continue with the series, you can have a look at the previous posts:

Bookmark and Share

Marshal-arts in XStream

You might already know various ways to process XML with java objects or to transform XML into different formats. XML transformation with XSLT can be quite difficult to implement because its concept differs from usual programming approaches.

I like the framework XStream to parse and generate XML because of its simple but flexible API. You can configure the XML with annotations on plain java classes, no XML schema or DTD is required. XStream’s documentation shows you in two minutes how to use it.

We are using XStream to process XML-messages asynchronously between clients and a server, where some clients might use an older XML dialect than others. This leads to the requirement that the server must support various versions of XML messages for both receiving and sending with its clients. We use XStream not only to process the messages but for transformation as well. … more

Bookmark and Share

“insert-or-update”: locking pitfalls with EJB3

The problem sounds like something very common: a server-side program in a multi-threaded environment has to save an entity. It must decide either to create a new instance or to load an existing instance and update it. I will show you some examples when using EJB3-entities (with Hibernate, tested with Oracle and Postgres).

We could call merge(): ["MyEntity" is the name for a business entity, just for the examples.]

Example 1:

MyEntity persistentEntity = entityManager.merge(detachedEntity);

or do it the explicit way, when some more business logic is required before we save:

Example 2:

  MyEntity persistentEntity = entityManager.find(MyEntity.class, detachedEntity.getId());
  boolean isNew = false;
  if(persistentEntity == null) {
    persistentEntity = new MyEntity();
    isNew = true;
  }
  // ... some business logic here that works with detachedEntity and persistentEntity
  if(isNew) {
    entityManager.persist(persistentEntity);
  } // otherwise update happens implicitly

But: This does not solve the concurrency problems we get when two transactions are doing the same thing at (nearly) the same time!

What could happen is, that both transactions try to load the object first where find() returns null, because the object is not stored yet. Thus both transactions will try to insert the entity, which would create the entity twice in the database or would cause one of the transactions to fail (e.g. because of a constraint violation).

You do not need much code to solve this situation, but be careful, there are some pitfalls!

… more

Bookmark and Share

Das Datenschutzdebakel

Im Zuge der Datenschutzaffäre um gehandelte Kunden- und Kontodaten meldet Golem.de heute:

Datenschützer: Adressen aller Bundesbürger im Umlauf

Ein Skandal! Wie konnte das nur passieren…?

Ich konnte es mir nicht verkneifen.

Bookmark and Share

Top 10 Maven Plugins

Whenever you start to build your project with Maven you are using plugins. There are different kinds of plugins: core plugins, packaging types or tool, reporting plugins, tools and plugins to generate IDE configurations.

Some of this plugins like clean, compile, install and others you are using everday. Maybe without to know that these are plugins.

Most of the plugins are highly configurable which helps you in the most situations. Most of the plugins are well documented on their own websites.

In this post I will present our 10 most valuable Maven plugins.

… more

Bookmark and Share

Extended BlazeDS and JMS example

We extended the example from the absolutly helpful Blog entry from Michael about BlazeDS and JMS. It demonstrates a flex app using BlazeDS with a message-destination from a JMS Topic using ActiveMQ (separate process). … more

Bookmark and Share

Selenium Testing of massive Ajax Apps

Testing of a web application is a hard work. You don’t handle with data in a direct way. You got a lot of markup around it. How to handle this in a flexible and more robust way could be found in the post Robust Portlet Testing.

If you have fought your way through the markup, you now get to another trap on your way to get your tests flying. The markup is changing, because you are using the Ajax technology. After the page is rendered there are asynchronous calls changing your DOM. You are asking: Where is the problem? The problem of testing is, that you need to teach your test tool, to look at the page in the same way you are looking at it. On the first look you want to get the third row of the table. But wait, it is still loading, even if there is just a minimal delay. If you do automatic tests they should run through all the tests as fast as possible. The tool is not to twiddle one’s thumbs to click on the button.

You need to write your tests in another way. The question isn’t only if the data could be found in the DOM, it is changing to if the surrounding element has loaded could the data be found then. And this is the essential point, where most recording tools like Selenium IDE are failing. It doesn’t give you a hint, what is loading after the DOM is ready the first time. Yes it is possible to add pause or a waitForElement-function before every field, but wouldn’t it be easier to have little helpers for the case.

… more

Bookmark and Share

Wrapper Quiz

Is following code compiling? If yes, what is the result?

public class Calculation {
    public static void main(String[] args) {
        Long result = 3l;
        result += new Long(3);

        if(Boolean.parseBoolean("Wrong") || Boolean.parseBoolean("True")) {
            result++;
        }

        System.out.println("Result: " + result );
    }
}
Bookmark and Share

agimatec Map Markers released under Creative Commons License

Since there do not seem to be many templates for markers to use with Google Maps or any other free map applications out there, we release our custom build markers to the public under the Creative Commons License. Feel free to use, modify and distribute them in free and commercial applications. The license only demands, that you give us credit for our original creation.

The template makes it easy to change colors and add icons, numbers or characters to the markers.

Just click the image to download an ZIP-archive, that contains the Photoshop template file. Any suggestions for modifications of or additions to the template are welcome.


Creative Commons License


agimatec Map Markers von
Roland Müller, agimatec GmbH steht unter einer
Creative Commons Namensnennung 3.0 Deutschland Lizenz.

Bookmark and Share