0

There is some specified location where feature files are present. There is need to copy these files to

src/test/resources/ 

before execution of test cases as a part of automation.

I tried using

@BeforeClass
//java code to do copying of files from one location to other

But Cucumber scans all feature files in the first place. So, it is failing as not finding any feature files which is mentioned under

@CucumberOptions(features = "src/test/resources/subscription.feature")
Grasshopper
  • 8,908
  • 2
  • 17
  • 32
KRR16
  • 187
  • 2
  • 3
  • 10

1 Answers1

0

Use the maven resources plugin in the validate phase to copy the feature files. Link, Change the outputDirectory and resource directory as per your configuration.

<plugin>
    <artifactId>maven-resources-plugin</artifactId>
    <version>3.0.2</version>
    <executions>
        <execution>
            <id>copy-resources</id>
            <phase>validate</phase>
            <goals>
                <goal>copy-resources</goal>
            </goals>
            <configuration>
            <!-- Destination folder -->     
         <outputDirectory>${basedir}\src\test\resources\features</outputDirectory>
                <resources>
                    <resource>
                    <!-- Source folder -->
                    <directory>E:\.....\nonresource</directory>
                    </resource>
               </resources>
          </configuration>
        </execution>
    </executions>
</plugin>
Grasshopper
  • 8,908
  • 2
  • 17
  • 32