dimanche 7 mars 2021

Run Java code for generating feature files before the cucumber test (i.e. maven surefire plugin)

I need to generate the feature file before running my Cucumber test. i tried by adding goal into pom.xml file but no success.

<plugin>
  <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    <executions>
      <execution>
        <phase>process-resources</phase>
        <goals>
          <goal>add-source</goal>
        </goals>
        <configuration>
           <sources>
              <source>src/test/resources/FeatureFiles</source>
           </sources>
        </configuration>
     </execution>
   </executions>
</plugin>
<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <executions>
       <execution>
          <id>before-test-suite-scripts</id>
          <phase>generate-test-resources</phase>
          <goals>
             <goal>java</goal>
          </goals>
          <configuration>
         <mainClass>com.nextgen.Utilities.CucumberGeneration</mainClass>
          </configuration>
       </execution>
     </executions>
</plugin>

Results which i am getting is :

[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed:
0.398 s - in com.nextgen.testrunner.TestRunner
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS

This is because there are no files for execution."

Please let me know how can I resolve this issue. i want to run the feature file generation code first and then the feature files testing.

Please Help!

Aucun commentaire:

Enregistrer un commentaire