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

de.ppi.selenium.junit.WebServerRule Maven / Gradle / Ivy

There is a newer version: 0.12
Show newest version
package de.ppi.selenium.junit;

import org.junit.rules.ExternalResource;

import de.ppi.selenium.browser.SessionManager;

/**
 * Junit-Rule to start a webserver.
 *
 */
public class WebServerRule extends ExternalResource {

    /**
     * The webserver.
     */
    private final WebServer webServer;

    /**
     *
     * Initiates an object of type WebServerRule.
     * 
     * @param webServer the webserver.
     */
    public WebServerRule(WebServer webServer) {
        this.webServer = webServer;
        SessionManager.getInstance().setDefaultBaseUrl(webServer.getBaseUrl());
    }

    @Override
    protected void before() throws Throwable {
        if (!webServer.isRunning()) {
            webServer.start();
        }
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy