Package jp.vmi.selenium.selenese

Source Code of jp.vmi.selenium.selenese.ParserTest

package jp.vmi.selenium.selenese;

import java.io.InputStream;

import org.apache.commons.io.IOUtils;
import org.junit.Test;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;

import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;

@SuppressWarnings("javadoc")
public class ParserTest {

    private static final String WITHOUT_BASE_URL = "/selenese/withoutBaseURL.html";
    private static final String TEST_SUITE = "/selenese/testSuite.html";

    @Test
    public void parseTestCaseWithoutBaseURL() {
        Runner runner = new Runner();
        runner.setDriver(new HtmlUnitDriver(true));
        InputStream is = null;
        try {
            is = getClass().getResourceAsStream(WITHOUT_BASE_URL);
            Selenese selenese = Parser.parse(WITHOUT_BASE_URL, is, runner.getCommandFactory());
            assertThat(selenese, is(instanceOf(TestCase.class)));
        } finally {
            IOUtils.closeQuietly(is);
        }
    }

    @Test
    public void parseTestSuite() {
        Runner runner = new Runner();
        runner.setDriver(new HtmlUnitDriver(true));
        InputStream is = null;
        try {
            is = getClass().getResourceAsStream(TEST_SUITE);
            Selenese selenese = Parser.parse(TEST_SUITE, is, runner.getCommandFactory());
            assertThat(selenese, is(instanceOf(TestSuite.class)));
        } finally {
            IOUtils.closeQuietly(is);
        }
    }
}
TOP

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

TOP
Copyright © 2018 www.massapi.com. 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.