Package net.jsunit.model

Examples of net.jsunit.model.BrowserLaunchSpecification


        assertErrorResponse(rootElement, "Invalid Browser ID '1000'");
    }

    public void testValid() throws Exception {
        Browser browser = new Browser(Browser.DEFAULT_SYSTEM_BROWSER, 0);
        server.launchBrowserTestRun(new BrowserLaunchSpecification(browser));
        BrowserResult browserResult = new BrowserResult();
        String id = String.valueOf(System.currentTimeMillis());
        browserResult.setId(id);
        browserResult.setBrowser(browser);
        server.accept(browserResult);
View Full Code Here


        MockProcessStarter starter = new MockProcessStarter();
        server.setProcessStarter(starter);
        MockTestRunListener listener = new MockTestRunListener();
        server.addTestRunListener(listener);

        server.launchBrowserTestRun(new BrowserLaunchSpecification(new Browser(DummyConfigurationSource.BROWSER_FILE_NAME, 0)));
        assertTrue(listener.browserTestRunStartedCalled);
        assertEquals(2, starter.commandPassed.length);
        assertEquals("iexplore.exe", starter.commandPassed[0]);
        assertEquals(DummyConfigurationSource.DUMMY_URL + "&browserId=0", starter.commandPassed[1]);
        assertFalse(listener.testRunFinishedCalled);
View Full Code Here

        server.setProcessStarter(starter);
        MockTestRunListener listener = new MockTestRunListener();
        server.addTestRunListener(listener);

        Browser browser = new Browser(DummyConfigurationSource.BROWSER_FILE_NAME, 0);
        server.launchBrowserTestRun(new BrowserLaunchSpecification(browser));
        assertTrue(listener.browserTestRunStartedCalled);
        assertTrue(listener.browserTestRunFinishedCalled);
        assertTrue(listener.result.failedToLaunch());
        assertFalse(server.isWaitingForBrowser(browser));
        assertEquals(new Browser("iexplore.exe", 0), listener.browser);
        assertEquals("iexplore.exe", listener.result.getBrowser().getStartCommand());
        assertSame(listener.result, server.lastResult());

        server.setProcessStarter(new MockProcessStarter());
        listener.reset();
        browser = new Browser("mybrowser2.exe", 1);
        server.launchBrowserTestRun(new BrowserLaunchSpecification(browser));
        assertTrue(server.isWaitingForBrowser(browser));
        assertTrue(listener.browserTestRunStartedCalled);
        assertFalse(listener.browserTestRunFinishedCalled);
        assertEquals(browser, listener.browser);
    }
View Full Code Here

    }

    public void testAcceptResult() {
        server.setProcessStarter(new MockProcessStarter());
        Browser browser = new Browser("mybrowser.exe", 0);
        server.launchBrowserTestRun(new BrowserLaunchSpecification(browser));
        BrowserResult result = new BrowserResult();
        result.setBrowser(browser);
        server.accept(result);
        assertEquals("mybrowser.exe", result.getBrowser().getStartCommand());
    }
View Full Code Here

        server.setProcessStarter(starter);
        MockTestRunListener listener = new MockTestRunListener();
        server.addTestRunListener(listener);

        String overrideUrl = "http://my.example.com:8080?submitResults=true&autoRun=true&browserId=0";
        server.launchBrowserTestRun(new BrowserLaunchSpecification(new Browser("mybrowser.exe", 0), overrideUrl));
        assertEquals(2, starter.commandPassed.length);
        assertEquals("mybrowser.exe", starter.commandPassed[0]);
        assertEquals(overrideUrl, starter.commandPassed[1]);
    }
View Full Code Here

        server.setProcessStarter(starter);
        MockTestRunListener listener = new MockTestRunListener();
        server.addTestRunListener(listener);

        String overrideUrlWithoutSubmitResults = "http://my.example.com:8080?param=value";
        server.launchBrowserTestRun(new BrowserLaunchSpecification(new Browser("mybrowser.exe", 0), overrideUrlWithoutSubmitResults));
        assertEquals(2, starter.commandPassed.length);
        assertEquals("mybrowser.exe", starter.commandPassed[0]);
        assertEquals(
                overrideUrlWithoutSubmitResults + "&autoRun=true&browserId=0&submitResults=localhost:" + DummyConfigurationSource.PORT + "/jsunit/acceptor",
                starter.commandPassed[1]
View Full Code Here

                return "";
            }
        }), new MockBrowserResultRepository());
        MockProcessStarter starter = new MockProcessStarter();
        server.setProcessStarter(starter);
        server.launchBrowserTestRun(new BrowserLaunchSpecification(new Browser("mybrowser.exe", 0)));
        assertFalse(server.lastResult().wasSuccessful());
        assertTrue(server.lastResult().getServerSideExceptionStackTrace().indexOf(NoUrlSpecifiedException.class.getName()) != -1);
    }
View Full Code Here

public class AcceptorFunctionalTest extends ServerFunctionalTestCase {

    public void testSubmission() throws Exception {
        Browser browser = new Browser(Browser.DEFAULT_SYSTEM_BROWSER, 0);
        server.launchBrowserTestRun(new BrowserLaunchSpecification(browser));

        StringBuffer buffer = new StringBuffer();
        addParameter(buffer, BrowserResultWriter.ID, "ID_foo", true);
        addParameter(buffer, BrowserResultWriter.USER_AGENT, "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)", false);
        addParameter(buffer, BrowserResultWriter.TIME, "4.3", false);
View Full Code Here

    public void testOverrideUrl() throws Exception {
        String overrideUrl = "  http://www.example.com:8954/jsunit/testRunner.html?testPage=http://www.example.com:8954/tests/myTests.html?autoRun=true&submitResults=http://www.example.com:8954/tests   ";
        action.setUrl(overrideUrl);
        assertEquals(TestRunnerAction.SUCCESS, action.execute());
        assertEquals(2, mockRunner.launchSpecs.size());
        BrowserLaunchSpecification spec1 = mockRunner.launchSpecs.get(0);
        BrowserLaunchSpecification spec2 = mockRunner.launchSpecs.get(1);
        assertTrue(spec1.hasOverrideUrl());
        assertEquals(overrideUrl.trim(), spec1.getOverrideUrl());
        assertTrue(spec2.hasOverrideUrl());
        assertEquals(overrideUrl.trim(), spec2.getOverrideUrl());
    }
View Full Code Here

TOP

Related Classes of net.jsunit.model.BrowserLaunchSpecification

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.