Package jp.vmi.selenium.selenese

Examples of jp.vmi.selenium.selenese.Runner


        + "Command#4: click(\"id=login\")"
        + "]";

    @Test
    public void registerRollup() throws Exception {
        Runner runner = new Runner();
        runner.setDriver(new HtmlUnitDriver(true));
        RollupRules rollupRules = runner.getRollupRules();
        rollupRules.load(getClass().getResourceAsStream("/rollup/user-extention-rollup.js"));
        IRollupRule rule = rollupRules.get("do_login");
        assertThat(rule, is(instanceOf(RollupRule.class)));
        Map<String, String> rollupArgs = new HashMap<String, String>();
        rollupArgs.put("username", "USERNAME");
View Full Code Here


    @Before
    public void initialize() {
        initDriver();

        testSuites = new ArrayList<TestSuite>();
        runner = new Runner() {
            @Override
            public Result execute(Selenese testSuite) {
                if (!(testSuite instanceof TestSuite))
                    throw new RuntimeException("The parameter is not TestSuite instance: " + testSuite);
                testSuites.add((TestSuite) testSuite);
View Full Code Here

    @SuppressWarnings("deprecation")
    @Ignore
    @Test
    public void generateHtmlResultOld() throws Exception {
        File root = getTmpRoot();
        Runner runner = new Runner();
        CommandFactory cf = runner.getCommandFactory();
        runner.setDriver(new HtmlUnitDriver(true));
        String s1name = "suite1";
        TestSuite s1 = Binder.newTestSuite(filename(root, s1name), s1name, runner);
        String s2name = "suite2";
        TestSuite s2 = Binder.newTestSuite(filename(root, s2name), s2name, runner);
        String c1name = "case1";
        TestCase c1 = Binder.newTestCase(filename(root, c1name), c1name, runner, "http://localhost");
        c1.addCommand(cf.newCommand(0, "echo", "c1"));
        String c2name = "case2";
        TestCase c2 = Binder.newTestCase(filename(root, c2name), c2name, runner, "http://localhost");
        c2.addCommand(cf.newCommand(0, "echo", "c2"));
        s2.addSelenese(c2);
        s1.addSelenese(c1);
        s1.addSelenese(s2);
        runner.setHtmlResultDir(root.getPath());
        s1.execute(null, runner);
        runner.finish();
    }
View Full Code Here

    @Test
    public void generateHtmlResult() throws Exception {
        File root = getTmpRoot();
        new File(root, "html").mkdir();
        new File(root, "img").mkdir();
        Runner runner = new Runner();
        WebDriverManager wdm = WebDriverManager.getInstance();
        wdm.setWebDriverFactory(WebDriverManager.PHANTOMJS);
        WebDriver driver = null;
        try {
            driver = wdm.get();
        } catch (RuntimeException e) {
            Assume.assumeNoException(e);
        }
        runner.setDriver(driver);
        runner.setHtmlResultDir(new File(root, "html").getPath());
        runner.setScreenshotAllDir(new File(root, "img").getPath());
        CommandFactory cf = runner.getCommandFactory();
        String s1name = "suite1";
        TestSuite s1 = Binder.newTestSuite(filename(root, s1name), s1name);
        String s2name = "suite2";
        TestSuite s2 = Binder.newTestSuite(filename(root, s2name), s2name);
        String c1name = "case1";
        TestCase c1 = Binder.newTestCase(filename(root, c1name), c1name, "http://localhost");
        c1.addCommand(cf, "store", "3", "index");
        c1.addCommand(cf, "while", "${index} > 0");
        c1.addCommand(cf, "open", "/form.html");
        c1.addCommand(cf, "storeEval", "${index} - 1", "index");
        c1.addCommand(cf, "endWhile");
        String c2name = "case2";
        TestCase c2 = Binder.newTestCase(filename(root, c2name), c2name, "http://localhost");
        c2.addCommand(cf, "open", "/form2.html");
        s2.addSelenese(c2);
        s1.addSelenese(c1);
        s1.addSelenese(s2);
        runner.execute(s1);
        runner.finish();
    }
View Full Code Here

     * @throws IOException exception.
     */
    @SuppressWarnings("deprecation")
    @Test
    public void stringMatchPatternOld() throws IOException {
        Runner runner = new Runner();
        WebDriverManager wdm = WebDriverManager.getInstance();
        wdm.setWebDriverFactory(WebDriverManager.HTMLUNIT);
        wdm.setDriverOptions(new DriverOptions());
        runner.setDriver(wdm.get());
        TestCase testCase = Binder.newTestCase("dummy", "dummy", runner, wsr.getBaseURL());
        CommandFactory commandFactory = runner.getCommandFactory();
        commandFactory.setProc(testCase.getProc());
        testCase.addCommand(commandFactory.newCommand(0, "open", "/assertion.html"));
        testCase.addCommand(commandFactory.newCommand(1, commandName, argument));
        Result result = testCase.execute(null, runner);
        assertThat(result, is(instanceOf(resultClass)));
View Full Code Here

    @Test
    public void stringMatchPattern() throws IOException {
        WebDriverManager wdm = WebDriverManager.getInstance();
        wdm.setWebDriverFactory(WebDriverManager.HTMLUNIT);
        wdm.setDriverOptions(new DriverOptions());
        Runner runner = new Runner();
        runner.setDriver(wdm.get());
        CommandFactory cf = runner.getCommandFactory();
        TestCase testCase = Binder.newTestCase("dummy", "dummy", wsr.getBaseURL());
        testCase.addCommand(cf, "open", "/assertion.html");
        testCase.addCommand(cf, commandName, argument);
        Result result = runner.execute(testCase);
        assertThat(result, is(instanceOf(resultClass)));
    }
View Full Code Here

    @Ignore("test fail on buildhive....")
    public void userFriendlyErrorMessage() throws IOException {
        WebDriverManager wdm = WebDriverManager.getInstance();
        wdm.setWebDriverFactory(WebDriverManager.HTMLUNIT);
        wdm.setDriverOptions(new DriverOptions());
        Runner runner = new Runner();
        runner.setDriver(wdm.get());
        runner.setOverridingBaseURL(wsr.getBaseURL());
        CommandFactory cf = runner.getCommandFactory();
        TestCase testCase = Binder.newTestCase("dummy", "dummy", wsr.getBaseURL());
        testCase.addCommand(cf, "open", "/index.html");
        testCase.addCommand(cf, "click", "link=linktext");
        Result result = runner.execute(testCase);
        assertThat(result.getMessage(), is("Failure: Element link=linktext not found"));
    }
View Full Code Here

    @Test
    public void userFriendlyAssertionMessage() throws IOException {
        WebDriverManager wdm = WebDriverManager.getInstance();
        wdm.setWebDriverFactory(WebDriverManager.HTMLUNIT);
        wdm.setDriverOptions(new DriverOptions());
        Runner runner = new Runner();
        runner.setDriver(wdm.get());
        runner.setOverridingBaseURL(wsr.getBaseURL());
        CommandFactory cf = runner.getCommandFactory();

        TestCase testCase = Binder.newTestCase("dummy", "dummy", wsr.getBaseURL());
        testCase.addCommand(cf, "open", "/assertion.html");
        testCase.addCommand(cf, "assertTitle", "title", "title");
        Result result = runner.execute(testCase);
        assertThat(result.getMessage(), is("Failure: Assertion failed (Result: [assertion test] / Expected: [title])"));
    }
View Full Code Here

    /**
     * Register user-defined command factory. (old style)
     */
    @Test
    public void registerUDCFOld() {
        Runner runner = new Runner();
        // runner.setBaseURL("http://localhost/");
        // runner.setDriver(new HtmlUnitDriver(true));
        CommandFactory cf = runner.getCommandFactory();
        cf.registerUserDefinedCommandFactory(new UserDefinedCommandFactory() {
            @Override
            public Command newCommand(int index, String name, String... args) {
                if ("test".equals(name)) {
                    return new TestCommand(index, name, args, args.length);
View Full Code Here

     * Register user-defined command factory.
     */
    @SuppressWarnings("unchecked")
    @Test
    public void registerUDCF() {
        Runner runner = new Runner();
        CommandFactory cf = runner.getCommandFactory();
        cf.registerCommandFactory(new ICommandFactory() {
            @Override
            public ICommand newCommand(int index, String name, String... args) {
                if ("test".equals(name)) {
                    return new TestCommandNew(index, name, args);
View Full Code Here

TOP

Related Classes of jp.vmi.selenium.selenese.Runner

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.