File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Testing and the fly likes Error in Jweb Unit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Error in Jweb Unit" Watch "Error in Jweb Unit" New topic

Error in Jweb Unit

prathana balaji
Ranch Hand

Joined: Oct 07, 2007
Posts: 30
import junit.framework.TestSuite;
import net.sourceforge.jwebunit.junit.WebTestCase;
import junit.framework.Test;
import junit.framework.TestCase;
import net.sourceforge.jwebunit.util.*;
import net.sourceforge.jwebunit.util.TestingEngineRegistry;

public class GoogleTest extends WebTestCase {
public static String searchLink = "";

public GoogleTest(String name)

public void setup() {

public void testSearch() {
setFormElement("q", "HttpUnit");

public static void main(String[] args) {
searchLink = args[0]; TestSuite(GoogleTest.class));


For the above code,While running the testcase from the command prompt I am getting the Following error
There was 1 failure:
1) warning(junit.framework.TestSuite$1)junit.framework.AssertionFailedError: Exc
eption in constructor: testSearch (java.lang.NullPointerException
at net.sourceforge.jwebunit.junit.WebTestCase.setTestingEngineKey(WebTes
at GoogleTest.<init>(
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
at java.lang.reflect.Constructor.newInstance(
at GoogleTest.main(
at GoogleTest.main(

Tests run: 1, Failures: 1, Errors: 0

Please help me in soving this problem

Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
I'd suggest that you take a look at line 1766 and see what might cause a NPE in that line.

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
wood burning stoves
subject: Error in Jweb Unit
It's not a secret anymore!