The following question was raised recently by someone who wants to migrate a Seam 2 application to AS 7 and eventually Java EE 6:
"Is there any guidance for how to migrate a library of SeamTest-based integration tests to Arquillian?"
The first answer, of course, is that you don't have to. You can still use SeamTest-based tests in AS 7. Of course, we recommend switching to Arquillian in the long run, in which case you'll be interested in reading on.
There is promising news regarding the question of migration. Work on the technology needed for this migration is currently in progress. We will be working from two ends, Seam 2 and Arquillian. The Seam 2 part mostly involves the input and expertise of our QE team. The Arquillian part is technical.
As it stands today, a (straightforward)* migration is not feasible because the functionality in SeamTest does not yet have a suitable match in Arquillian. There are two requirements for this match:
- An extension that packages the Seam 2 jars and starts Seam 2 in the container
- A JSF lifecycle controller inside the test
Arquillian does have #1, an extension for packaging the Seam 2 jars and starting Seam 2 in the container . That can be used for testing Seam components directly (meaning testing POJO classes and EJBs). Testing outjection is tricky still.
Arquillian currently does not have #2, an extension which supports the request lifecycle control that most SeamTest cases make use of. Here's an example of the type of test I'm talking about .
We were going to recommend the use of Arquillian + JSFUnit, an integration that has been in place for more than a year. However, we discovered a major deficiency that can only be solved by redesigning JSFUnit. The deficiency is that the JSF request lifecycle execution in JSFUnit isn't the same as the manual control w/ callbacks in SeamTest. It's not a 1-to-1 mapping.
The good news is that we have a prototype which is very promising . We are currently working out the name, but it's likely going to be called Arquillian Warp. As soon as we get a first preview release of Warp out, QE is going to work on converting the tests in Seam 2.3. If that goes well, a guide will follow based on that experience. That guide will appear on http://arquillian.org/guides/
It may take a couple of months to get there, but that is where we are headed.
To end on a positive note, the Arquillian-based tests are going to be significantly more accurate and valuable than tests written with SeamTest. We aren't just changing the platform, we are changing the philosophy to one which is much more sound.
If you are a Seam 2 user looking to migrate to AS 7 and are holding off for the following reason:
"It's a non-starter to have our test environment differ from our runtime."
I hate to break it to you, but SeamTest *always* used a test environment that differed from the runtime. That's why we are so adamant about running Arquillian tests in a *real* container. We want to end the mockery.
* I say straightforward because there is always a workaround, but the requirements of a migration in my definition is having a straightforward path.