本文整理汇总了Java中net.masterthought.cucumber.Configuration类的典型用法代码示例。如果您正苦于以下问题:Java Configuration类的具体用法?Java Configuration怎么用?Java Configuration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Configuration类属于net.masterthought.cucumber包,在下文中一共展示了Configuration类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateReportForJsonFiles
import net.masterthought.cucumber.Configuration; //导入依赖的package包/类
private void generateReportForJsonFiles(File reportOutputDirectory,
List<String> jsonFiles) {
String jenkinsBasePath = "";
String buildNumber = "1";
String projectName = project.getName();
Configuration configuration = new Configuration(reportOutputDirectory, projectName);
configuration.setParallelTesting(false);
configuration.setJenkinsBasePath(jenkinsBasePath);
configuration.setRunWithJenkins(false);
configuration.setBuildNumber(buildNumber);
ReportBuilder reportBuilder = new ReportBuilder(jsonFiles, configuration);
reportBuilder.generateReports();
getLog().info(format("Cucumber HTML report has been generated at: %s/cucumber-html-reports/overview-features.html", reportOutputDirectory.getAbsolutePath()));
}
示例2: readResults
import net.masterthought.cucumber.Configuration; //导入依赖的package包/类
@Override
public List<TestCaseResult> readResults(final Path source) {
List<String> cucumberJsonFiles = listFiles(source, "cucumber*.json")
.map(Path::toString)
.collect(Collectors.toList());
if (cucumberJsonFiles.isEmpty()) {
return Collections.emptyList();
}
Configuration configuration = new Configuration(source.toFile(), "Unknown project");
File embeddings = configuration.getEmbeddingDirectory();
if (!embeddings.exists() && !embeddings.mkdirs()) {
LOGGER.warn("Could not create embeddings directory");
}
ReportParser parser = new ReportParser(configuration);
List<Feature> features = parse(parser, cucumberJsonFiles);
listFiles(embeddings.toPath(), "embedding*")
.forEach(storage::addAttachment);
return features.stream()
.flatMap(feature -> Stream.of(feature.getElements()).map(this::convert))
.collect(Collectors.toList());
}
示例3: generateReports
import net.masterthought.cucumber.Configuration; //导入依赖的package包/类
public void generateReports() throws VelocityException, IOException {
listFilesForFolder(reportOutputDirectory);
String jenkinsBasePath = "";
String buildNumber = "1";
String projectName = "cucumber-jvm";
boolean runWithJenkins = false;
boolean parallelTesting = false;
Configuration configuration = new Configuration(reportOutputDirectory, projectName);
configuration.setParallelTesting(parallelTesting);
configuration.setRunWithJenkins(runWithJenkins);
configuration.setBuildNumber(buildNumber);
ReportBuilder reportBuilder = new ReportBuilder(list, configuration);
reportBuilder.generateReports();
}
示例4: generateReport
import net.masterthought.cucumber.Configuration; //导入依赖的package包/类
public static void generateReport(String basePath) {
Collection<File> jsonFiles = org.apache.commons.io.FileUtils.listFiles(new File(basePath), new String[]{"json"}, true);
List<String> jsonPaths = new ArrayList(jsonFiles.size());
jsonFiles.forEach(file -> jsonPaths.add(file.getAbsolutePath()));
Configuration config = new Configuration(new File(basePath), basePath);
ReportBuilder reportBuilder = new ReportBuilder(jsonPaths, config);
reportBuilder.generateReports();
}
示例5: generateReport
import net.masterthought.cucumber.Configuration; //导入依赖的package包/类
private static void generateReport(String karateOutputPath) {
Collection<File> jsonFiles = FileUtils.listFiles(new File(karateOutputPath), new String[] {"json"}, true);
List<String> jsonPaths = new ArrayList(jsonFiles.size());
jsonFiles.forEach(file -> jsonPaths.add(file.getAbsolutePath()));
Configuration config = new Configuration(new File("target"), "demo");
ReportBuilder reportBuilder = new ReportBuilder(jsonPaths, config);
reportBuilder.generateReports();
}
示例6: generateReport
import net.masterthought.cucumber.Configuration; //导入依赖的package包/类
private static void generateReport(String karateOutputPath) {
Collection<File> jsonFiles = FileUtils.listFiles(new File(karateOutputPath), new String[]{"json"}, true);
List<String> jsonPaths = new ArrayList(jsonFiles.size());
for (File file : jsonFiles) {
jsonPaths.add(file.getAbsolutePath());
}
Configuration config = new Configuration(new File("target"), "demo");
ReportBuilder reportBuilder = new ReportBuilder(jsonPaths, config);
reportBuilder.generateReports();
}
示例7: generateReport
import net.masterthought.cucumber.Configuration; //导入依赖的package包/类
private static void generateReport(String karateOutputPath) {
Collection<File> jsonFiles = org.apache.commons.io.FileUtils.listFiles(new File(karateOutputPath), new String[]{"json"}, true);
List<String> jsonPaths = new ArrayList(jsonFiles.size());
for (File file : jsonFiles) {
jsonPaths.add(file.getAbsolutePath());
}
Configuration config = new Configuration(new File("target"), "mock");
ReportBuilder reportBuilder = new ReportBuilder(jsonPaths, config);
reportBuilder.generateReports();
}
示例8: onFinish
import net.masterthought.cucumber.Configuration; //导入依赖的package包/类
@Override
public void onFinish(ISuite suite) {
try {
File jsonfile = new File("target/");
File reportOutputDirectory = new File("target/test-classes/reports/cucumberreports/");
String[] fileNames = jsonfile.list(new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
if(name.endsWith(".json"))
return true;
return false;
}
});
for (int i = 0; i < fileNames.length; i++) {
fileNames[i] = jsonfile.getAbsolutePath() + "/" + fileNames[i];
}
List<String> jsonFiles = Arrays.asList(fileNames);
Configuration configuration = new Configuration(reportOutputDirectory, suite.getName());
configuration.setStatusFlags(true, true, true);
ReportBuilder reportBuilder = new ReportBuilder(jsonFiles, configuration);
reportBuilder.generateReports();
oLog.info("Report Generated : " + configuration.getReportDirectory());
} catch (Exception e) {
oLog.equals(e);
}
}
示例9: generateReport
import net.masterthought.cucumber.Configuration; //导入依赖的package包/类
private void generateReport(Run<?, ?> build, FilePath workspace, TaskListener listener) throws InterruptedException, IOException {
log(listener, "Preparing Cucumber Reports");
// create directory where trends will be stored
final File trendsDir = new File(build.getParent().getRootDir(), TRENDS_DIR);
if (!trendsDir.exists()) {
if (!trendsDir.mkdir()) {
throw new IllegalStateException("Could not create directory for trends: " + trendsDir);
}
}
// source directory (possibly on slave)
String parsedJsonReportDirectory = evaluateMacro(build, workspace, listener, jsonReportDirectory);
log(listener, String.format("JSON report directory is \"%s\"", parsedJsonReportDirectory));
FilePath inputDirectory = new FilePath(workspace, parsedJsonReportDirectory);
File directoryForReport = build.getRootDir();
File directoryJsonCache = new File(directoryForReport, ReportBuilder.BASE_DIRECTORY + File.separatorChar + ".cache");
if (!directoryJsonCache.exists() && !directoryJsonCache.mkdirs()) {
throw new IllegalStateException("Could not create directory for cache: " + directoryJsonCache);
}
//Copies Json Files To Cache...
int copiedFiles = inputDirectory.copyRecursiveTo(DEFAULT_FILE_INCLUDE_PATTERN, new FilePath(directoryJsonCache));
log(listener, String.format("Copied %d json files from workspace \"%s\" to reports directory \"%s\"",
copiedFiles, inputDirectory.getRemote(), directoryJsonCache));
//Copies Classifications Files To Cache...
int copiedFilesProperties = inputDirectory.copyRecursiveTo(DEFAULT_FILE_INCLUDE_PATTERN_CLASSIFICATIONS, new FilePath(directoryJsonCache));
log(listener, String.format("Copied %d properties files from workspace \"%s\" to reports directory \"%s\"",
copiedFilesProperties, inputDirectory.getRemote(), directoryJsonCache));
// exclude JSONs that should be skipped (as configured by the user)
String[] jsonReportFiles = findJsonFiles(directoryJsonCache, fileIncludePattern, fileExcludePattern);
List<String> jsonFilesToProcess = fullPathToJsonFiles(jsonReportFiles, directoryJsonCache);
log(listener, String.format("Processing %d json files:", jsonReportFiles.length));
for (String jsonFile : jsonFilesToProcess) {
log(listener, jsonFile);
}
String buildNumber = Integer.toString(build.getNumber());
// this works for normal and multi-config/matrix jobs
// for matrix jobs, this will include the matrix job name and the specific
// configuration/permutation name as well. this also includes the '/' so
// we don't have to modify how the cucumber plugin report generator's links
String projectName = build.getParent().getDisplayName();
Configuration configuration = new Configuration(directoryForReport, projectName);
configuration.setParallelTesting(parallelTesting);
configuration.setRunWithJenkins(true);
configuration.setBuildNumber(buildNumber);
configuration.setTrends(new File(trendsDir, TRENDS_FILE), trendsLimit);
// null checker because of the regression in 3.10.2
configuration.setSortingMethod(sortingMethod == null ? SortingMethod.NATURAL : SortingMethod.valueOf(sortingMethod));
if (CollectionUtils.isNotEmpty(classifications)) {
log(listener, String.format("Adding %d classifications", classifications.size()));
addClassificationsToBuildReport(build, workspace, listener, configuration, classifications);
}
List<String> classificationFiles = fetchPropertyFiles(directoryJsonCache, listener);
if(CollectionUtils.isNotEmpty(classificationFiles)) {
configuration.addClassificationFiles(classificationFiles);
}
ReportBuilder reportBuilder = new ReportBuilder(jsonFilesToProcess, configuration);
Reportable result = reportBuilder.generateReports();
if (hasReportFailed(result, listener)) {
// redefine build result if it was provided by plugin configuration
if (buildStatus != null) {
log(listener, "Build status is changed to " + buildStatus);
build.setResult(Result.fromString(buildStatus));
} else {
log(listener, "Build status is left unchanged");
}
}
}
示例10: addClassificationsToBuildReport
import net.masterthought.cucumber.Configuration; //导入依赖的package包/类
private void addClassificationsToBuildReport(Run<?, ?> build, FilePath workspace, TaskListener listener, Configuration configuration, List<Classification> listToAdd) throws InterruptedException, IOException {
for (Classification classification : listToAdd) {
log(listener, String.format("Adding classification - %s:%s", classification.key, classification.value));
configuration.addClassifications(classification.key, evaluateMacro(build, workspace, listener, classification.value));
}
}