1

I am writing a multi-module test automation framework where i have a parent project known as framework and 2 child modules/projects - core and customer. customer module is dependent on core module

enter image description here

I am using cucumber-junit to write feature files. Both core and customer modules will have feature files and step definitions. Following dependencies are added in core project:

enter image description here

I have created a TestRunner.java file in core module as shown below:

enter image description here

When i run TestRunner.java as a JUnit test, it only executes the feature file in core module. The feature file in customer module do not execute.

Is there a way to execute all the feature files in all child projects / modules?

Please suggest. Thanks.

silver_noodles
  • 361
  • 2
  • 4
  • 12

1 Answers1

1

You can use a parent pom.xml in the framework project and within it declare the two child modules. Then execute the maven command like "clean install" on this parent pom.

Framework pom...
    <groupId>multi.mod</groupId>
    <artifactId>framework</artifactId>
    <version>1.0.0</version>
    <packaging>pom</packaging>

    <modules>
        <module>core</module>
        <module>customer</module>
    </modules>

    You can add common dependencies and refer to them in the child modules by the 
    artifact id mentioned in the parent pom.

Core pom...
   <parent>
        <groupId>multi.mod</groupId>
        <artifactId>framework</artifactId>
        <version>1.0.0</version>
    </parent>
    <artifactId>core</artifactId>
    <packaging>jar</packaging>

   Add dependencies as required

Customer pom...
   <parent>
        <groupId>multi.mod</groupId>
        <artifactId>framework</artifactId>
        <version>1.0.0</version>
    </parent>
    <artifactId>customer</artifactId>
    <packaging>jar</packaging>

  Add dependencies as required plus add core module also as dependency
       <dependency>
            <groupId>multi.mod</groupId>
            <artifactId>core</artifactId>
        </dependency>

Run clean install on the parent pom ie. framework

https://books.sonatype.com/mvnex-book/reference/multimodule.html

Grasshopper
  • 8,908
  • 2
  • 17
  • 32
  • You only have to use the 'Framework pom...'. This is called aggregation/aggretor-pom, which will call all it specified modules. – Robert Scholte Jul 07 '18 at 18:01