-
1. Re: Testing deployment of pre-built .war to various web servers
maschmid Apr 18, 2012 11:20 AM (in response to jfuerth)It is easy to deploy an existing war with ShrinkWrap:
ShrinkWrap.create(ZipImporter.class, "foo.war").importFrom(new File("target/foo.war"))
(you just have to make sure your test runs in the integration-test maven phase, that is after "package", .. you will probably run the test itself in a completely different maven project anyway)
You can use HtmlUnitDriver with Arquillian Drone:
(just replace the "WebDriver" in the example with http://code.google.com/p/selenium/wiki/HtmlUnitDriver )
-
2. Re: Testing deployment of pre-built .war to various web servers
jfuerth Apr 23, 2012 1:42 PM (in response to maschmid)Thanks, Marek. I tried that and it worked great.
I'm just now grappling with whether or not a Maven build is the appropriate vehicle for this type of deployment testing. It's a lot of baggage to add to the main pom generated by the archetype. Putting it in a second "deployment testing" pom alongside the main pom might be an option. It could be useful to show how to approach deployment testing, or it could be a big distraction from the quickstart itself.
Maybe just a script in the parent project that creates the archetype?
How have others approached testing of quickstarts that must be deployable to various containers?
-Jonathan
-
3. Re: Testing deployment of pre-built .war to various web servers
kpiwko Apr 24, 2012 3:37 AM (in response to jfuerth)ShrinkWrap Maven Resolver contains a MavenImporter. Not really so much useful at this point of view, as it basically automagically picks up the result of "mvn package", however with possibility to select profiles and spawning a completely different Maven execution from Surefire (in upcoming versions), it should allow you to construct JAR/WAR/EAR easily.
See following for further details:
-
4. Re: Testing deployment of pre-built .war to various web servers
dan.j.allen Apr 24, 2012 3:57 AM (in response to kpiwko)This is very nice:
WebArchive archive = ShrinkWrap.create(MavenImporter.class, "test.war") .loadEffectivePom("pom.xml").importBuildOutput() .as(WebArchive.class);
Since this is a case which can come up quite often, and in some test suites be used over and over again, I'd like to see an annotation for this scenario (which activates this build chain under the covers). Something like:
@RunWith(Arquillian.class) @DeployBuildOutput public class MyFunctionalTest { @ArquillianResource private URL url; @Test public void shouldBehaveSomeWay() { // make a request to the url } }
Of course, in this case, a @Deployment method would not be required (which is possible through an extension). Thoughts?
-
5. Re: Testing deployment of pre-built .war to various web servers
dan.j.allen Apr 24, 2012 4:03 AM (in response to dan.j.allen)I had hacked up an extension prototype a while back that implements this idea, though it uses the older ShrinkWrap Resolver...which would be replaced w/ Karel's snippet.
https://gist.github.com/2477705
It reminded me I had a better name for the deploy annotation:
@RunWith(Arquillian.class) @DeployProjectArtifact public class MyFunctionalTest { ... }
If we pursue this, where do you think this belongs? In Drone? In a module by itself?
-
6. Re: Testing deployment of pre-built .war to various web servers
kpiwko Apr 24, 2012 4:06 AM (in response to dan.j.allen)Such requirement exists for a pretty long time here: https://issues.jboss.org/browse/ARQ-417 .
Now we have a ShrinkWrap Resolver Maven Plugin, @DeployBuildOutput might work without specifying path to the pom, active profiles, etc. However, IDE support for the plugin is still an open question here.
This is an actual show-stopper for the moment https://issues.jboss.org/browse/SHRINKRES-18 . If implemented, creating an Arquillian extension with @DeployBuildOuput annotation would be an easy task.
-
7. Re: Testing deployment of pre-built .war to various web servers
kpiwko Apr 24, 2012 4:15 AM (in response to dan.j.allen)I think it should be a part of ShrinkWrap Maven Resolver. Once on classpath, you can do Maven magic for deployments.
-
8. Re: Testing deployment of pre-built .war to various web servers
silenius Apr 24, 2012 9:48 AM (in response to kpiwko)+1 to add this to ShrinkWrap Maven Resolver.
Can you create a Jira entry to make it easier to follow?
-
9. Re: Testing deployment of pre-built .war to various web servers
dan.j.allen May 1, 2012 10:40 PM (in response to silenius)It turns out, there was already a JIRA...it just was before its time
https://issues.jboss.org/browse/ARQ-74 - Base test deployment on project in which test is run