我得到空点异常。不知道我在这里做错了什么。我得到的错误是java.lang.NullPointerException
for goToLogin
and test1()
atbeginAt("someJspFile")
import net.sourceforge.jwebunit.junit.JWebUnit;
import net.sourceforge.jwebunit.util.TestingEngineRegistry;
import org.junit.Before;
import org.junit.*;
import static net.sourceforge.jwebunit.junit.JWebUnit.*;
import static net.sourceforge.jwebunit.junit.JWebUnit.setBaseUrl;
public class ServletTest {
@Before
public void prepare() {
JWebUnit.setTestingEngineKey(TestingEngineRegistry.TESTING_ENGINE_HTMLUNIT); // use HtmlUnit
JWebUnit.setTestingEngineKey(TestingEngineRegistry.TESTING_ENGINE_WEBDRIVER); // use WebDriver
}
public void setUp() throws Exception {
setBaseUrl("http://localhost:8080");
}
@Test
public void goToLogin() {
beginAt( "someJspFile.jsp" );
}
@Test
public void test1() {
beginAt("someJspFile.jsp");
setTextField("username", "test");
submit();
assertTitleEquals("Welcome, test!");
}
}