All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ousell.cucumber2junit-maven-plugin.1.3.1.source-code.junitTestClass.vm Maven / Gradle / Ivy

package $packageName;

import static org.junit.Assert.fail;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;

/** Generated by cucumber2junit-maven-plugin. */

public class $className {
  
  /**
   * Copy the feature files to the temp folder.
   *
   * @throws IOException {@link IOException}
   */
  @BeforeClass
  public static void init() throws IOException {
    Paths.get("$featuresOutputDirectory").toFile().getParentFile().mkdirs();
    Files.copy(
      ${className}.class.getClassLoader().getResourceAsStream("$featuresClasspath/$feature.getFileName()"),
      Paths.get("$featuresOutputDirectory/$feature.getFileName()"),
      StandardCopyOption.REPLACE_EXISTING);
  }
  
  #foreach($scenario in $scenarios)@Test
  public void $scenario.getCamelCaseName()() throws Throwable {
    if (CucumberMain.runFeatures(
            new String[] {
              "--glue", "$stepsPackage", 
              "$featuresOutputDirectory/$feature.getFileName():$scenario.lineNumber"})
        != 0) {
      fail();
    }
  }
  
  #end
  
  /** Remove the feature files from the temp folder. */
  @AfterClass
  public static void clean() {
    Paths.get("$featuresOutputDirectory/$feature.getFileName()").toFile().delete();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy