Displaying NullPointerException
Hello,
I am new to Java and trying to run below code however I am getting NullPointerException and I couldn't figure out how to instantiate varScriptToolContxt.
Appreciate if someone cana help me.
public class helloWorld {
public static void main(String[] args) throws IOException{
ScriptingContext varScriptToolContxt = null;
String s = printHW(varScriptToolContxt);
Application.showMessage(s);
}
public static String printHW(ScriptingContext varScriptToolContxt) throws IOException
{
return varScriptToolContxt.getValue("ExecuteScenario");
}
}
Comments
-
I couldn't figure out how to instantiate varScriptToolContxt
You do not instantiate ScriptingContext. Instead, SOAtest passes the ScriptingContext object as an argument to your Java method. In SOAtest you would typically add an Extension tool to your test suite. Next, configure the Extension tool with the name of your Java class and the java method which has an argument of type ScriptingContext (not String[] args). There are examples in the User's Guide under Extensibility and Scripting Basics.
0