2 Replies Latest reply on Aug 31, 2014 9:25 PM by nagaraja.prabha

    Arquillian without build tools (neither Ant nor Maven .. )

    nagaraja.prabha

      I am trying to write my first JUnit test using Arquillian , I have gone through different tutorials with maven but I wanted to run a unittest without using maven or ant . Is it possible?

      I have created dynamic web project with simple servlet and one jsp in Eclipse, Added all required jars to build path . Running the unit test using Run As , results in class not found exception. Am i missing any step or configuration?

       

      Jars that are added

      arquillian-container-spi-1.1.5.Final

      arquillian-container-test-api-1.1.5.Final

      arquillian-junit-container-1.1.5.Final

      arquillian-junit-core-1.1.5.Final

      arquillian-tomcat-common-1.0.0.CR7

      arquillian-tomcat-managed-6-1.0.0.CR7

      shrinkwrap-api-1.2.2

      shrinkwrap-descriptors-api-base-2.0.0-alpha-5

      shrinkwrap-descriptors-api-javaee-2.0.0-alpha-5

      weld-servlet-1.1.8.Final

       

       

      Caused by: java.lang.ClassNotFoundException: org.jboss.arquillian.test.spi.TestRunnerAdaptorBuilder

        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)

        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)

        at java.security.AccessController.doPrivileged(Native Method)

        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)

        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)

        ... 7 more

        • 1. Re: Arquillian without build tools (neither Ant nor Maven .. )
          smikloso

          Hi,

           

          so it obviously seems that you have not added all necessary jars to your class path.

           

          If you really want to do it without Maven, I would suggest to firstly run it via Maven, execute mvn dependency:tree after you successful test run and after that double check you have all jars on your class path from that tree when you want to run it without Maven. I am almost sure that you have missed some jar.

           

          HTH

           

          Stefan

          • 2. Re: Arquillian without build tools (neither Ant nor Maven .. )
            nagaraja.prabha

            Thanks Stefan Miklosovic , it worked out. Later I have learnt to build application with Ant and was successful in writing very simple unit test. Just in case if anyone is interested in simple ant script which i have used

            <?xml version="1.0" encoding="UTF-8"?>

            <ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven" >

              <info organisation="org.jboss.arquillian.showcase" module="arquillian-showcase-cdi" revision="1.0.0-SNAPSHOT">

              </info>

              <configurations>

              <conf name="default" visibility="public"

              description="runtime dependencies and master artifact can be used with this conf"

              extends="runtime,master" />

              <conf name="master" visibility="public"

              description="contains only the artifact published by this module itself, with no transitive dependencies" />

              <conf name="compile" visibility="public"

              description="this is the default scope, used if none is specified. Compile dependencies are available in all classpaths." />

              <conf name="compile-only" visibility="public"

              description="this is the default scope, used if none is specified. Compile dependencies are available in all classpaths."

              extends="compile" />

              <conf name="runtime" visibility="public"

              description="this scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath."

              extends="compile" />

              <conf name="test" visibility="public"

              description="this scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath."

              extends="runtime" />

              <conf name="test-tomcat6-embedded" visibility="private"

              description="This scope is for executing Arquillian tests in Embedded Tomcat"

              extends="test" />

              <conf name="test-weld-embedded" visibility="private"

              description="This scope is for executing Arquillian tests in Weld Embedded"

              extends="test" />

             

             

              </configurations>

             

             

              <dependencies>

              <dependency org="org.jboss.spec" name="jboss-javaee-6.0"

              rev="${version.jboss_javaee6_spec}" conf="compile-only->compile(*)">

              <artifact name="jboss-javaee-6.0" type="pom" ext="pom" conf="" />

              </dependency>

              <dependency org="org.jboss.arquillian.junit" name="arquillian-junit-container"

              rev="${version.arquillian}" conf="test->default(*)" />

              <dependency org="junit" name="junit" rev="${version.junit}"

              conf="test->default(*)" />

              <dependency org="org.hamcrest" name="hamcrest-core" rev="${version.hamcrest}"

              conf="test->default(*)" />

             

             

              <dependency org="org.jboss.arquillian.container" name="arquillian-weld-ee-embedded-1.1"

              rev="${version.arquillian}" conf="test-weld-embedded->default(*)" />

              <!--<dependency org="org.jboss.spec" name="jboss-javaee-6.0"

              rev="${version.jboss_javaee6_spec}" conf="test-weld-embedded->compile(*)">

              <artifact name="jboss-javaee-6.0" type="pom" ext="pom" conf="" />

              </dependency>-->

              <dependency org="org.jboss.weld" name="weld-core"

              rev="${version.weld_core}" conf="test-weld-embedded->default(*)" />

              <dependency org="org.slf4j" name="slf4j-log4j12" rev="${version.slf4j}"

              conf="test-weld-embedded->default(*)" />

              <dependency org="log4j" name="log4j" rev="${version.log4j}"

              conf="test-weld-embedded->default(*)" />

             

             

              <dependency org="org.jboss.arquillian.container" name="arquillian-tomcat-embedded-6"

              rev="${version.arquillian}" conf="test-tomcat6-embedded->default(*)" />

              <dependency org="org.apache.tomcat" name="tomcat-catalina"

              rev="${version.tomcat}" conf="test-tomcat6-embedded->default(*)" />

              </dependencies>

            </ivy-module>

            1 of 1 people found this helpful