Created
October 19, 2011 19:55
-
-
Save simcap/1299474 to your computer and use it in GitHub Desktop.
SauceLab simple Selenium test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package fr.xebia.ateliers.cloudbees.saucelab; | |
import static org.junit.Assert.assertEquals; | |
import java.net.URL; | |
import java.util.concurrent.TimeUnit; | |
import org.junit.After; | |
import org.junit.Before; | |
import org.junit.Test; | |
import org.openqa.selenium.Platform; | |
import org.openqa.selenium.WebDriver; | |
import org.openqa.selenium.remote.DesiredCapabilities; | |
import org.openqa.selenium.remote.RemoteWebDriver; | |
public class SimpleSauceLabTest { | |
private WebDriver driver; | |
@Test | |
public void home_page_should_have_correct_title() throws Exception { | |
this.driver.get("http://petclinic-ndeloof.atelier-xebia.cloudbees.net/"); | |
assertEquals("PetClinic :: a Spring Framework demonstration", driver.getTitle()); | |
} | |
@Before | |
public void initWebDriver() throws Exception { | |
DesiredCapabilities capabillities = DesiredCapabilities.firefox(); | |
capabillities.setCapability("version", "5"); | |
capabillities.setCapability("platform", Platform.XP); | |
capabillities.setCapability("name", "Simple selenium test written in Java"); | |
this.driver = new RemoteWebDriver(new URL("http://atelier-xebia:ab03b6f6-14b8-4458-b7c7-cc306ba0b8c0@ondemand.saucelabs.com:80/wd/hub"), | |
capabillities); | |
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); | |
} | |
@After | |
public void cleanup() throws Exception { | |
this.driver.quit(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment