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

com.version1.webdriver.results.ResultsManager Maven / Gradle / Ivy

Go to download

A simple Selenium framework offering externalised configuration, a good selection of libraries for supporting test data, simple WebDriver browser binary resolution and an opinionated approach for WebDriver test design.

There is a newer version: 2.0.1
Show newest version
package com.version1.webdriver.results;

import java.io.File;
import java.nio.file.Paths;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Responsible for sorting out folders and anything else to do with reporting
 */
public class ResultsManager {

    private SimpleDateFormat timestamp;
    private File screenshotDirectory;

    /**
     *
     */
    public ResultsManager() {
        this.timestamp = new SimpleDateFormat("yyyy.MM.dd.HH.mm.ss");
    }

    /**
     * Creates a run specific directory that is timestamped to store screenshots
     * @return File representing created screenshot directory
     */
    public File createScreenshotDirectory() {
        this.screenshotDirectory = new File(
                Paths.get("target").toString() + "/screenshots-" + timestamp.format(new Date()));
        this.screenshotDirectory.mkdir();
        return this.screenshotDirectory;
    }

    /**
     *
     * @return File representing screenshot directory
     */
    public File getScreenshotDirectory() {
        return this.screenshotDirectory;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy