1 Reply Latest reply on Oct 18, 2016 5:31 AM by bmajsak

    Can't read system property variable from Arquillian test

    fstarred

      How to read a property variable from arquillian test?

       

      I tried configuring either arquillian.xml and maven surefire plugin with the following:

       

      arquillian.xml

       

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

         

      <configuration>

      <property name="test.config.file">/d/opt/subz/config/configuration-TEST.properties</property>

          </configuration>

      </container>

       

      pom.xml

       

      <profile>

          <id>arq-jbossas-remote</id>

          <build>

              <plugins>

                  <plugin>

                      <artifactId>maven-surefire-plugin</artifactId>

                      <configuration>

                          <systemPropertyVariables>

                              <test.config.file>${test.config.file}</test.config.file>

                          </systemPropertyVariables>                                                                                                       

                      </configuration>

                  </plugin>

                  <plugin>

                      <groupId>org.jboss.shrinkwrap.resolver</groupId>

                      <artifactId>shrinkwrap-resolver-maven-plugin</artifactId>

                      <version>${version.shrinkwrap.resolver}</version>                                            

                      <executions>

                          <execution>

                              <goals>

                                  <goal>propagate-execution-context</goal>

                              </goals>

                          </execution>

                      </executions>

                  </plugin>

              </plugins>

          </build>

      </profile>

       

      However, when calling System.getProperty("test.config.file") from Arquillian @Test, it always return null

        • 1. Re: Can't read system property variable from Arquillian test
          bmajsak

          Don't confuse arquillian properties with system properties. These are two different things. `arquillian.xml` is used to configure its extensions only. If you want to use config property do it regular maven way (or simply by adding -D to your build).

           

          Another problem which you are facing is that you execute against remote container, which means it's started upfront as a different JVM process. If you are running in-container tests it's looking up system properties available for this JBoss instance. Maybe you should tweak your server configuration and put system property there?