[jboss-as7-dev] testsuite

Kabir Khan kabir.khan at jboss.com
Mon Feb 14 14:04:00 EST 2011


On 14 Feb 2011, at 18:44, ssilvert at redhat.com wrote:

> So let me ask it this way.  What's the easiest way to get an  
> Arquillian test running with AS7?  It looks like the answer might be  
> to use remote.  I almost got that running with  
> jboss-as-arquillian-container-remote.  Am I required to use the forked  
> Surefire with remote?

The forked surefire plugin (which is not really being used yet) is not required for remote. To do an embedded test, simply copy what the smoke tests do.

> 
> Without it, I got this message in the AS7 console:
> 
> 13:06:33,072 INFO  [org.jboss.as.server.deployment] (pool-3-thread-4)  
> Content wi
> th name test.war added at location  
> C:\projects\as7trunk\jboss-as\build\target\jb
> oss-7.0.0.Alpha2\standalone\data\content\24\5a3cbc919f50f4d7384197c5755fd7fb5c83
> 9a\content
> 
> But there were two strange things.  First, I got this in my test output:
> -------------------------------------------------------------------------------
> Test set: org.jboss.jsfunit.example.hellojsf.HelloJSFTest
> -------------------------------------------------------------------------------
> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 13.846  
> sec <<< FAILURE!
> testInitialPage(org.jboss.jsfunit.example.hellojsf.HelloJSFTest)  Time  
> elapsed: 6.089 sec  <<< ERROR!
> java.lang.ClassNotFoundException:  
> org.jboss.jsfunit.example.hellojsf.HelloJSFTest
> 
> I can see that the test class was indeed added to the WEB-INF/classes.  
>  So I shouldn't get ClassNotFoundException.
> 
> But, it looks like jboss-as-arquillian-container-remote doesn't know  
> I'm creating a WAR because it put all the supporting classes in the  
> root of my WAR instead of putting them in WEB-INF/lib or  
> WEB-INF/classes.

Unless you tell Shrinkwrap you're creating a web archive it will create a normal jar. From WarTestCase in smoke tests:

    @Deployment
    public static Archive<?> getDeployment(){
        return ShrinkWrapUtils.createWebArchive("demos/war-example.war", SimpleServlet.class.getPackage());
    }

    public static WebArchive createWebArchive(String archiveName, Package...packages) {
        WebArchive archive = ShrinkWrap.create(WebArchive.class, getBaseArchiveName(archiveName));
        addPackages(archive, packages);
        addResources(archiveName, archive);
        return archive;
    }

IIRC ShrinkWrap will put things in the right place if you create a WebArchive. For all other archive types root is the default location





More information about the jboss-as7-dev mailing list