1

How do I pass the test case to geb via maven commandline:

I have a test case class named GebishOrgSpec2.groovy I want to pass this test case maven and let geb run it over the command line. I am having successful build but no run of the test case How do I solve this problem?

This is my pom.xml

  <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.19</version>
        <configuration>
          <includes>
            <include>${inc.TestCase}</include>
          </includes>
          <systemPropertyVariables>
            <geb.build.reportsDir>target/test-reports/geb</geb.build.reportsDir>
          </systemPropertyVariables>
        </configuration>
      </plugin>

I have tried the following codes and they are all not running the testcase

mvn -Dinc.TestCase=GebishOrgSpec2.groovy test
mvn -Dinclude=GebishOrgSpec2.groovy test
mvn install -Dinc.TestCase=GebishOrgSpec2.groovy 
mvn install -Dinclude=GebishOrgSpec2.groovy 

I have tried these links How to run Geb TestCases from windows command line?

Grails geb getting parameters from commandline

Geb exception when running tests in maven

they are all not working

System.getProperty("inc.TestCase") is returning null as well I want to add that if I add the test case directly into the pom it does run successfully can you please help

eskoba
  • 532
  • 1
  • 7
  • 25
  • I would appreciate feedback to my answer. I took time to test and write it for you and add links to documentation websites. – kriegaex May 19 '19 at 15:20
  • @kriegaex I would like to first of apologize for the delay of my feedback. I was trying to pass additional user defined variables which where not working and this took my attention away. Please I plead with you to accept my apologies. – eskoba May 21 '19 at 00:14

1 Answers1

0

Don't use in-/excludes in your POM for something you want to do from the command line. It is much easier, both for

This works beautifully for Spock/Geb tests.

kriegaex
  • 63,017
  • 15
  • 111
  • 202