1 Reply Latest reply on Jan 3, 2017 5:23 AM by Matous Jobanek

    Could not lookup value for field java.net.URL in Arquillian

    sachin patil Newbie

      Hi,

       

      i am trying to run this arquillian code.

       

       

       

       

      @RunWith(Arquillian.class)

      public class ArquillianTest {

          private static final String WEBAPP_SRC = "src/main/webapp/pages/shared";

                 

       

       

          @Inject

          LoginBean loginBean;

         

          @Deployment(testable = true)

          public static WebArchive createDeployment() throws IOException {

          System.out.println("****************************************  file path:"+new File(WEBAPP_SRC).isDirectory());

              return ShrinkWrap.create(WebArchive.class, "acp.war")

                  .addClasses(LoginBean.class,PropertiesConfigurationAccess.class)

               // .addAsResource("src/main/webapp/pages/shared/login.jspx") // .addAsWebResource(new File(WEBAPP_SRC), "login.jspx")

                  // .addAsWebResource(new File(WEBAPP_SRC), "home.xhtml")

                  .merge(ShrinkWrap.create(GenericArchive.class).as(ExplodedImporter.class)

                      .importDirectory(WEBAPP_SRC).as(GenericArchive.class),

                      "/", Filters.include(".*\\.jspx$"))

                     

                  .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")

                  .addAsWebInfResource(

                      new StringAsset("<faces-config version=\"2.0\"/>"),

                      "faces-config.xml");

          }

         

          @Drone

          DefaultSelenium browser;

         

          @ArquillianResource

          URL deploymentUrl;

         

         

          @Test @RunAsClient

          public void should_login_with_valid_credentials(@ArquillianResource URL deploymentUrl) {

        

          System.out.println("*************************  deplyment url:"+deploymentUrl.toString());

              browser.open(deploymentUrl.toString().replaceFirst("/$", "") + "/login.jspx");

             

              browser.type("id=frmLogin:txtUsername", "user1");

              browser.type("id=frmLogin:secPassword", "demo");

              browser.click("id=frmLogin:btnLogin");

              browser.waitForPageToLoad("15000");

       

       

              Assert.assertTrue("User should be logged in!",

                  browser.isElementPresent("xpath=//li[contains(text(),'Welcome')]"));

          }

      }

       

       

      and my arquillian.xml file is like this

       

       

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

      <arquillian xmlns="http://jboss.org/schema/arquillian"

          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

          xsi:schemaLocation="

              http://jboss.org/schema/arquillian

              http://jboss.org/schema/arquillian/arquillian_1_0.xsd">

       

          <container qualifier="jboss" default="true">

          <protocol type="jmx-as7">

             <property name="executionType">REMOTE</property>

        </protocol>

        <configuration>

               <property name="jbossHome">C:\\jboss-eap-6.4</property>

               <property name="managementAddress">127.0.0.1</property>

              <property name="managementPort">8080</property>

              <property name="username">sachin</property>

              <property name="password">S$ashwini44</property>

         

        </configuration>

         </container>

          <extension qualifier="selenium">

              <property name="browser">*googlechrome C:\Program Files (x86)\Google\Chrome\Application\chrome.exe</property>

          </extension>

         

      </arquillian>

       

       

      the exception that i am getting is

       

      java.lang.RuntimeException: Could not lookup value for field java.net.URL com.test.arquillian.ArquillianTest.deploymentUrl

        at org.jboss.arquillian.test.impl.enricher.resource.ArquillianResourceTestEnricher.enrich(ArquillianResourceTestEnricher.java:61)

       

      could you please help?