reena Mehta

Greenhorn
+ Follow
since Nov 17, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by reena Mehta


please tell me can i write Servlet test cases and Struts Test cases in same test Class
10 years ago


please tell me how to add run time path as parameter in struts test case
10 years ago


Hi - I use eclipse to run this test case and point "WEB-INF" folder for classpath and I still get the error message below. could you please help me this issue? Thanks

junit 3.8.2. jar
jdk 1.6
Strut-config is located at WebRoot/WEB-INF folder.

MY TEST CLASS IS

package com.citi.cmb.gbnp.action;

import servletunit.struts.MockStrutsTestCase;
import com.orbitech.cash.xbnp.vo.MCPMultiTierVO;


public class MCPDispatchActionTest extends MockStrutsTestCase {

MCPMultiTierVO mcpMultiTierVO;
public MCPDispatchActionTest(String name) {
super(name);
}

protected void setUp() throws Exception {
super.setUp();
mcpMultiTierVO =new MCPMultiTierVO();
mcpMultiTierVO.setHeaderAccountNumber("1000");
mcpMultiTierVO.setStructID("1010");
mcpMultiTierVO.setSturctName("xyz");

}

protected void tearDown() throws Exception {
}
public void test() {


setConfigFile("/WEB-INF/struts-config.xml");
setRequestPathInfo("/MCPAction");
actionPerform();
}
}

ERROR IS


servletunit.struts.ExceptionDuringTestError: A NullPointerException was thrown. This may indicate an error in your ActionForm, or it may indicate that the Struts ActionServlet was unable to find struts config file. TestCase is running from D:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\xbnp directory. Context directory has not been set. Try calling setContextDirectory() with a relative or absolute path. struts config file must be found under the context directory, the directory the test case is running from, or in the classpath.
at servletunit.struts.MockStrutsTestCase.actionPerform(MockStrutsTestCase.java:407)
at com.citi.cmb.gbnp.action.MCPDispatchActionTest.test(MCPDispatchActionTest.java:30)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
------------
Root Cause:
------------
java.lang.NullPointerException
at servletunit.struts.MockStrutsTestCase.getActionServlet(MockStrutsTestCase.java:331)
at servletunit.struts.MockStrutsTestCase.actionPerform(MockStrutsTestCase.java:394)
at com.citi.cmb.gbnp.action.MCPDispatchActionTest.test(MCPDispatchActionTest.java:30)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)






10 years ago

hi
When i am running test-cases in junit
I got Error
servletunit.struts.ExceptionDuringTestError: A NullPointerException was thrown. This may indicate an error in your ActionForm, or it may indicate that the Struts ActionServlet was unable to find struts config file. TestCase is running from D:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\xbnp directory. Context directory has not been set. Try calling setContextDirectory() with a relative or absolute path. struts config file must be found under the context directory, the directory the test case is running from, or in the classpath.
at servletunit.struts.MockStrutsTestCase.actionPerform(MockStrutsTestCase.java:407)
at com.citi.cmb.gbnp.bdp.BenefitTestCases.test(BenefitTestCases.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)



please help me resolve this error
10 years ago
Please tell me how to test DAO in struts1.2 using Junit
i m new in testing. please help me
10 years ago
i am new in testing
kindly give one example of test strutsApplicatio with Junit .it's urgent
10 years ago
how to add validation in jsp using java scripts
please give me some example
no i just want to open JSP file like index.jsp
how write java script for opening JSP file
please help me
10 years ago
JSP

I just want to write java script code for opening any jsp file.
please help me

How to parse a Xml String
please help me.
10 years ago
i am trying to covert stringdate in to Sql date

stringDate is holding value 2008-03-19 19:44:58
#
# DateFormat formater = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
# java.util.Date parsedUtilDate = formater.parse(stringDate);
# java.sql.Date sqltDate= new java.sql.Date(parsedUtilDate.getTime());


output is: 2008-01-19
but i want same as 2008-03-19 19:44:58
please help me

Thanks
reena mehta


i just want convert String date "2010-09-08T14:10:03.220Z"
in to Date format in java to enter in Oracle database
please give me some solutions
10 years ago
i just want convert this type of string (-8.099996484816074E-4) in double
please explain me
10 years ago