I am getting null point exception. Not sure what I am doing wrong here. Error I get is java.lang.NullPointerException
for goToLogin
and test1()
at beginAt("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!");
}
}