Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package example;
- import org.junit.Before;
- import org.junit.Test;
- import com.thoughtworks.selenium.SeleneseTestCase;
- public class GoogStringTest extends SeleneseTestCase {
- private final String DIRECTORY_PREFIX =
- "file:///C:/Users/mbolin/workspace/closure-library/";
- @Override
- @Before
- public void setUp() throws Exception {
- final String url = DIRECTORY_PREFIX;
- final String browserString = "*firefox";
- // This initializes the protected "selenium" field with the base URL for the
- // tests and the browser to use when running the tests.
- setUp(url, browserString);
- }
- @Test
- public void testGoogString() throws Exception {
- // Opens the URL in Firefox.
- selenium.open(DIRECTORY_PREFIX + "closure/goog/string/string_test.html");
- // Because the test runs automatically when the HTML file is loaded, poll
- // for up to 5 seconds to see whether the test is complete.
- selenium.waitForCondition(
- "window.G_testRunner && window.G_testRunner.isFinished()",
- "5000");
- // Invoke this snippet of JavaScript in the browser to query whether the
- // test succeeded or failed.
- String success = selenium.getEval("window.G_testRunner.isSuccess()");
- boolean isSuccess = "true".equals(success);
- if (!isSuccess) {
- // If the test failed, report the reason why.
- String report = selenium.getEval("window.G_testRunner.getReport()");
- fail(report);
- }
- }
- }
Add Comment
Please, Sign In to add comment