I was looking for a simple solution to test @WebFilter servlet filters. The tests that I had used a lot of mocks, but really just left me unsatisfied. It was not a real world production solution. How would they "really" behave in the actual server environment. I had been using Arquillian to do some testing of our CDI layer, and decided to try it on filters.
In the last post, we took a look at the server side of our OAuth2 system. In this post, we’ll take a quick look at the unit tests that will act as TheUser.
In this post I want to demonstrate how Rest-Services can be integration tested using JBoss Arquillian1 and Glassfish-Embedded2. To do so we first need a Rest-Service which can be tested. So first of all we create a new maven-web-project and add the following rest resource. It is a very simple resource which returns a contact for a given identifier, but for our demo it will suffice.
Everybody knows that you need to write unit tests for your business code. But you also want to know when somebody (or you) breaks the configuration and that your Database Access Layer works properly.
Now that the long awaited stable version of the Arquillian framework is released I wanted to demonstrate some interesting features of this framework that really eases writing and running of integration tests for Java EE 6 applications in many different ways.
Das Testen von Container-Komponenten im Java-EE-Umfeld ist eine anstrengende Sache. Denn automatisierte Testroutinen muss man sich mühselig selbst basteln. Mit der nun freigegebenen Version 1.0.0 des JBoss-Projekts Arquillian steht nun eine erste komplette Suite für Integrationstests zur Verfügung.
The objective of Arquillian is to go further in simplicity and conciseness to further accelerate writing tests JavaEE. Although this is a Red Hat project, it is not just an extension of JBoss for unit testing. Arquillian wants to be more general, and supports other containers like Tomcat or GlassFish. This is what we see in this article that shows how a test with JUnit EJB using JPA with EclipseLink and GlassFish.
Some time ago I have been playing with Java Server Faces 2.0 (e.g. JSF 2) and JSFUnit in combination with Arquillian and Embedded Glassfish as a Proof Of Concept for unit testing JSF applications.
As our applications are being developped with the Oracle ADF framework, I was wondering if it would be possible to do the same with ADF based applications.
This is an, let's call it accidental post. I was looking into transactional CDI observers and playing around with GlassFish embedded to run some integration tests against it. But surprisingly this did not work too well and I am still figuring out, where exactly the problems are while using the plain embedded GlassFish for that. In the meantime I switched to Arquillian.
I’m fed up with unit testing !
It’s 2012 and my first resolution of the year is to finally tell the truth about testing : unit testing is pretty much useless when your code runs inside a container. How do you unit test an EJB which relies on the container services (i.e transaction, injection, security…) ? Well, you mock the database access, you mock your security layer, you mock your dependencies, you mock your validation layer… to test what ?
In the first installment we setup a basic web application with JEE6, JSF2, Primefaces running on Glassfish using Eclipse for the IDE. We'll continue here to add testing with Arquillian and Persistence with EclipseLink/JPA2. Once again we're simply tweaking Nicklas Karlsson's examples except we're making it a little less JBoss specific.
This is the last blog post in the three-part series on unit testing services managed by the most popular types of containers in the Java world.
The Arquillian library from JBoss solves this problem by providing the opportunity to programmatically create and deploy archives on any kind of embedded server (JBoss, Glassfish, Jetty). In the same time you can declare the dependency of your test to the server-managed objects and you don’t have to look them up any more in the JNDI context.
Describes a patch to Arquillian's GlassfishEmbeddedContainer.java so it'll setup your embedded instance at a permanent location, allowing you to setup all the datasources you want in the instance's domain.xml file.
Click in to find related links.