runnerfunctionaltest.java

来自「sourcode about java basic」· Java 代码 · 共 48 行

JAVA
48
字号
package jsunit.java.tests_server.net.jsunit;

import net.jsunit.model.ResultType;
import org.jdom.Document;

import java.net.URLEncoder;

public class RunnerFunctionalTest extends FunctionalTestCase {

    public void testSimple() throws Exception {
        webTester.beginAt("runner");
        Document result = responseXmlDocument();
        assertSuccessfulRunResult(
                result,
                ResultType.SUCCESS,
                "http://localhost:" + port + "/jsunit/tests/jsUnitUtilityTests.html", 2);
    }

    public void testOverrideUrl() throws Exception {
        webTester.beginAt("runner?url=" + URLEncoder.encode("http://127.0.0.1:" + port + "/jsunit/testRunner.html?testPage=http://127.0.0.1:" + port + "/jsunit/tests/jsUnitUtilityTests.html&autoRun=true&submitresults=true", "UTF-8"));
        Document result = responseXmlDocument();
        assertSuccessfulRunResult(
                result,
                ResultType.SUCCESS,
                "http://127.0.0.1:" + port + "/jsunit/tests/jsUnitUtilityTests.html", 2);
    }

    public void testSpecifyBrowser() throws Exception {
        webTester.beginAt("runner?browserId=0");
        Document result = responseXmlDocument();
        assertSuccessfulRunResult(
                result,
                ResultType.SUCCESS,
                "http://localhost:" + port + "/jsunit/tests/jsUnitUtilityTests.html", 1);
    }

    public void testSpecifyInvalidBrowser() throws Exception {
        webTester.beginAt("runner?browserId=23");
        Document result = responseXmlDocument();
        assertErrorResponse(result.getRootElement(), "Invalid browser ID: 23");
    }

    protected boolean shouldMockOutProcessStarter() {
        return false;
    }

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?