Re: StrutsTestCases
hi ichy,i tried your suggestion but still prob is still ther. On 4/28/06, ichy <[EMAIL PROTECTED]> wrote: > > hi Chaitanya > > when i use strutstestcase, i usually specify config file in setUp() as > > public void setUp() throws Exception { >super.setUp(); >setConfigFile("/WEB-INF/config/struts-config.xml"); > } > > according to javadoc, the path can be either an absolute path like you set > or a relative path from WEB-INF. > > you can try > > 1. call setConfigFile() in setUp() > 2. specify a relative path > > i hope this will help. > > regards. > > ichy > > > 2006/4/28, Chaitanya Parkhi <[EMAIL PROTECTED]>: > > hi Ed,ya this is the same problem i m trying to solve. i hav removed > that > > addtional slash before "D:" but still its not working, & also i i forgot > to > > mention in my first mail that i m getting follwing warnings on my consol > > window: > > > > > > log4j:WARN No appenders could be found for logger ( > > servletunit.struts.MockStrutsTestCase). > > > > log4j:WARN Please initialize the log4j system properly. > > > > > > > > On 4/27/06, Ed Griebel <[EMAIL PROTECTED]> wrote: > > > > > > There was a question about this a couple of days ago where web.xml was > > > not being found. Also, it looks like you have a leading slash before > > > the "D:" in setConfigFile(), that could be the problem. > > > > > > HTH > > > -ed > > > > > > On 4/27/06, Chaitanya Parkhi <[EMAIL PROTECTED]> wrote: > > > > hi friends i m working on Struts Test Cases ,i have written the > > > following > > > > code,for testing accurate user login from login page for my > application > > > i > > > > hav included strutsTest-2.1.3.jar,junit.jar from JUNIT_HOME > > > directory,when i > > > > run the following code i m getting following failures: > > > > > > > > 1.junit.framework.AssertionFailedError: The /WEB-INF/web.xml was not > > > found. > > > > 2.junit.framework.AssertionFailedError: No tests found in > > > > servletunit.struts.MockStrutsTestCase > > > > > > > > can anybody plz tell me whats a problem? is ther anything reqd to > write > > > in > > > > web.xml for StrutstestCases? > > > > > > > > > > > > import servletunit.struts.MockStrutsTestCase; > > > > > > > > public class TestLoginAction extends MockStrutsTestCase { > > > > > > > > public void setUp() throws Exception > > > > { > > > > super.setUp(); > > > > } > > > > > > > > public void tearDown() throws Exception > > > > { > > > > super.tearDown(); > > > > } > > > > > > > > public TestLoginAction(String testName) > > > > { > > > > super(testName); > > > > } > > > > > > > > > > > > public void testSuccessfulLogin() { > > > > > > > > > > > > > > > > > > setConfigFile("/D:/Projects/Silk-Server/Phase2-RTQA1-Branch/SilkMobileServerWeb/WebRoot/WEB-INF/config/struts- > > > > config.xml"); > > > > > > > > > > > > setRequestPathInfo("/login"); > > > > addRequestParameter("username","cdpadmin"); > > > > addRequestParameter("password","cdp"); > > > > > > > > > > > > actionPerform(); > > > > > > > > String[] actionErrors = {"username.required"," > password.required > > > "}; > > > > verifyActionErrors(actionErrors); > > > > > > > > > > > > } > > > > > > > > public void testFailedLogin() { > > > > > > > > addRequestParameter("username","cdpadmin"); > > > > addRequestParameter("password","indiana"); > > > > setRequestPathInfo("/login"); > > > > actionPerform(); > > > > > > > > > > > > verifyTilesForward("success","success.tiles.def"); > > > > > > > > verifyActionErrors(new String[] {"error.password.mismatch"," > > > > error.username.required","error.password.required"}); > > > > } > > > > > > > > } > > > > > > > > > > > > > > - > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
Re: StrutsTestCases
hi Chaitanya when i use strutstestcase, i usually specify config file in setUp() as public void setUp() throws Exception { super.setUp(); setConfigFile("/WEB-INF/config/struts-config.xml"); } according to javadoc, the path can be either an absolute path like you set or a relative path from WEB-INF. you can try 1. call setConfigFile() in setUp() 2. specify a relative path i hope this will help. regards. ichy 2006/4/28, Chaitanya Parkhi <[EMAIL PROTECTED]>: > hi Ed,ya this is the same problem i m trying to solve. i hav removed that > addtional slash before "D:" but still its not working, & also i i forgot to > mention in my first mail that i m getting follwing warnings on my consol > window: > > > log4j:WARN No appenders could be found for logger ( > servletunit.struts.MockStrutsTestCase). > > log4j:WARN Please initialize the log4j system properly. > > > > On 4/27/06, Ed Griebel <[EMAIL PROTECTED]> wrote: > > > > There was a question about this a couple of days ago where web.xml was > > not being found. Also, it looks like you have a leading slash before > > the "D:" in setConfigFile(), that could be the problem. > > > > HTH > > -ed > > > > On 4/27/06, Chaitanya Parkhi <[EMAIL PROTECTED]> wrote: > > > hi friends i m working on Struts Test Cases ,i have written the > > following > > > code,for testing accurate user login from login page for my application > > i > > > hav included strutsTest-2.1.3.jar,junit.jar from JUNIT_HOME > > directory,when i > > > run the following code i m getting following failures: > > > > > > 1.junit.framework.AssertionFailedError: The /WEB-INF/web.xml was not > > found. > > > 2.junit.framework.AssertionFailedError: No tests found in > > > servletunit.struts.MockStrutsTestCase > > > > > > can anybody plz tell me whats a problem? is ther anything reqd to write > > in > > > web.xml for StrutstestCases? > > > > > > > > > import servletunit.struts.MockStrutsTestCase; > > > > > > public class TestLoginAction extends MockStrutsTestCase { > > > > > > public void setUp() throws Exception > > > { > > > super.setUp(); > > > } > > > > > > public void tearDown() throws Exception > > > { > > > super.tearDown(); > > > } > > > > > > public TestLoginAction(String testName) > > > { > > > super(testName); > > > } > > > > > > > > > public void testSuccessfulLogin() { > > > > > > > > > > > > > > setConfigFile("/D:/Projects/Silk-Server/Phase2-RTQA1-Branch/SilkMobileServerWeb/WebRoot/WEB-INF/config/struts- > > > config.xml"); > > > > > > > > > setRequestPathInfo("/login"); > > > addRequestParameter("username","cdpadmin"); > > > addRequestParameter("password","cdp"); > > > > > > > > > actionPerform(); > > > > > > String[] actionErrors = {"username.required","password.required > > "}; > > > verifyActionErrors(actionErrors); > > > > > > > > > } > > > > > > public void testFailedLogin() { > > > > > > addRequestParameter("username","cdpadmin"); > > > addRequestParameter("password","indiana"); > > > setRequestPathInfo("/login"); > > > actionPerform(); > > > > > > > > > verifyTilesForward("success","success.tiles.def"); > > > > > > verifyActionErrors(new String[] {"error.password.mismatch"," > > > error.username.required","error.password.required"}); > > > } > > > > > > } > > > > > > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: StrutsTestCases
hi Ed,ya this is the same problem i m trying to solve. i hav removed that addtional slash before "D:" but still its not working, & also i i forgot to mention in my first mail that i m getting follwing warnings on my consol window: log4j:WARN No appenders could be found for logger ( servletunit.struts.MockStrutsTestCase). log4j:WARN Please initialize the log4j system properly. On 4/27/06, Ed Griebel <[EMAIL PROTECTED]> wrote: > > There was a question about this a couple of days ago where web.xml was > not being found. Also, it looks like you have a leading slash before > the "D:" in setConfigFile(), that could be the problem. > > HTH > -ed > > On 4/27/06, Chaitanya Parkhi <[EMAIL PROTECTED]> wrote: > > hi friends i m working on Struts Test Cases ,i have written the > following > > code,for testing accurate user login from login page for my application > i > > hav included strutsTest-2.1.3.jar,junit.jar from JUNIT_HOME > directory,when i > > run the following code i m getting following failures: > > > > 1.junit.framework.AssertionFailedError: The /WEB-INF/web.xml was not > found. > > 2.junit.framework.AssertionFailedError: No tests found in > > servletunit.struts.MockStrutsTestCase > > > > can anybody plz tell me whats a problem? is ther anything reqd to write > in > > web.xml for StrutstestCases? > > > > > > import servletunit.struts.MockStrutsTestCase; > > > > public class TestLoginAction extends MockStrutsTestCase { > > > > public void setUp() throws Exception > > { > > super.setUp(); > > } > > > > public void tearDown() throws Exception > > { > > super.tearDown(); > > } > > > > public TestLoginAction(String testName) > > { > > super(testName); > > } > > > > > > public void testSuccessfulLogin() { > > > > > > > > > setConfigFile("/D:/Projects/Silk-Server/Phase2-RTQA1-Branch/SilkMobileServerWeb/WebRoot/WEB-INF/config/struts- > > config.xml"); > > > > > > setRequestPathInfo("/login"); > > addRequestParameter("username","cdpadmin"); > > addRequestParameter("password","cdp"); > > > > > > actionPerform(); > > > > String[] actionErrors = {"username.required","password.required > "}; > > verifyActionErrors(actionErrors); > > > > > > } > > > > public void testFailedLogin() { > > > > addRequestParameter("username","cdpadmin"); > > addRequestParameter("password","indiana"); > > setRequestPathInfo("/login"); > > actionPerform(); > > > > > > verifyTilesForward("success","success.tiles.def"); > > > > verifyActionErrors(new String[] {"error.password.mismatch"," > > error.username.required","error.password.required"}); > > } > > > > } > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
Re: StrutsTestCases
hi Ed,ya this is the same problem i m trying to solve. i hav removed that addtional slash before "D:" but still its not working, & also i i forgot to mention in my first mail that i m getting follwing warnings on my consol window: log4j:WARN No appenders could be found for logger ( servletunit.struts.MockStrutsTestCase). log4j:WARN Please initialize the log4j system properly. On 4/27/06, Ed Griebel <[EMAIL PROTECTED]> wrote: > > There was a question about this a couple of days ago where web.xml was > not being found. Also, it looks like you have a leading slash before > the "D:" in setConfigFile(), that could be the problem. > > HTH > -ed > > On 4/27/06, Chaitanya Parkhi <[EMAIL PROTECTED]> wrote: > > hi friends i m working on Struts Test Cases ,i have written the > following > > code,for testing accurate user login from login page for my application > i > > hav included strutsTest-2.1.3.jar,junit.jar from JUNIT_HOME > directory,when i > > run the following code i m getting following failures: > > > > 1.junit.framework.AssertionFailedError: The /WEB-INF/web.xml was not > found. > > 2.junit.framework.AssertionFailedError: No tests found in > > servletunit.struts.MockStrutsTestCase > > > > can anybody plz tell me whats a problem? is ther anything reqd to write > in > > web.xml for StrutstestCases? > > > > > > import servletunit.struts.MockStrutsTestCase; > > > > public class TestLoginAction extends MockStrutsTestCase { > > > > public void setUp() throws Exception > > { > > super.setUp(); > > } > > > > public void tearDown() throws Exception > > { > > super.tearDown(); > > } > > > > public TestLoginAction(String testName) > > { > > super(testName); > > } > > > > > > public void testSuccessfulLogin() { > > > > > > > > > setConfigFile("/D:/Projects/Silk-Server/Phase2-RTQA1-Branch/SilkMobileServerWeb/WebRoot/WEB-INF/config/struts- > > config.xml"); > > > > > > setRequestPathInfo("/login"); > > addRequestParameter("username","cdpadmin"); > > addRequestParameter("password","cdp"); > > > > > > actionPerform(); > > > > String[] actionErrors = {"username.required","password.required > "}; > > verifyActionErrors(actionErrors); > > > > > > } > > > > public void testFailedLogin() { > > > > addRequestParameter("username","cdpadmin"); > > addRequestParameter("password","indiana"); > > setRequestPathInfo("/login"); > > actionPerform(); > > > > > > verifyTilesForward("success","success.tiles.def"); > > > > verifyActionErrors(new String[] {"error.password.mismatch"," > > error.username.required","error.password.required"}); > > } > > > > } > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
Re: StrutsTestCases
There was a question about this a couple of days ago where web.xml was not being found. Also, it looks like you have a leading slash before the "D:" in setConfigFile(), that could be the problem. HTH -ed On 4/27/06, Chaitanya Parkhi <[EMAIL PROTECTED]> wrote: > hi friends i m working on Struts Test Cases ,i have written the following > code,for testing accurate user login from login page for my application i > hav included strutsTest-2.1.3.jar,junit.jar from JUNIT_HOME directory,when i > run the following code i m getting following failures: > > 1.junit.framework.AssertionFailedError: The /WEB-INF/web.xml was not found. > 2.junit.framework.AssertionFailedError: No tests found in > servletunit.struts.MockStrutsTestCase > > can anybody plz tell me whats a problem? is ther anything reqd to write in > web.xml for StrutstestCases? > > > import servletunit.struts.MockStrutsTestCase; > > public class TestLoginAction extends MockStrutsTestCase { > > public void setUp() throws Exception > { > super.setUp(); > } > > public void tearDown() throws Exception > { > super.tearDown(); > } > > public TestLoginAction(String testName) > { > super(testName); > } > > > public void testSuccessfulLogin() { > > > > setConfigFile("/D:/Projects/Silk-Server/Phase2-RTQA1-Branch/SilkMobileServerWeb/WebRoot/WEB-INF/config/struts- > config.xml"); > > > setRequestPathInfo("/login"); > addRequestParameter("username","cdpadmin"); > addRequestParameter("password","cdp"); > > > actionPerform(); > > String[] actionErrors = {"username.required","password.required"}; > verifyActionErrors(actionErrors); > > > } > > public void testFailedLogin() { > > addRequestParameter("username","cdpadmin"); > addRequestParameter("password","indiana"); > setRequestPathInfo("/login"); > actionPerform(); > > > verifyTilesForward("success","success.tiles.def"); > > verifyActionErrors(new String[] {"error.password.mismatch"," > error.username.required","error.password.required"}); > } > > } > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: StrutsTestCases
U need to set the contect path of ur application: setContextDirectory(new File(Your_Application_ContextPath)); -Original Message- From: Phil Zoio [mailto:[EMAIL PROTECTED] Sent: Monday, April 24, 2006 3:39 PM To: Struts Users Mailing List Subject: Re: StrutsTestCases You should be able to solve the problem by adding the WEB-INF directory onto your classpath. I couldn't get it to work otherwise Chaitanya Parkhi wrote: >hi guys i hav created a java file by using MockObjectStrutsTestCases >which tests for a simple login form which takes Login Name & password >as a input.in this file i hav following method > >public void testSuccessfulLogin() { > >setConfigFile("/WEB-INF/struts-config.xml"); > >setRequestPathInfo("/login"); >addRequestParameter("username","cdp"); >addRequestParameter("password","[EMAIL PROTECTED]"); > >actionPerform(); > >String[] actionErrors = {"username.required","password.required"}; >verifyActionErrors(actionErrors); } > >if i run the above test junit window shows that ther r no errors,but >shows a warning that WB-INF\web.xml not found does any1 knows why? > > > >--- >- > >No virus found in this incoming message. >Checked by AVG Free Edition. >Version: 7.1.385 / Virus Database: 268.4.5/322 - Release Date: >22/04/2006 > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: StrutsTestCases
You should be able to solve the problem by adding the WEB-INF directory onto your classpath. I couldn't get it to work otherwise Chaitanya Parkhi wrote: hi guys i hav created a java file by using MockObjectStrutsTestCases which tests for a simple login form which takes Login Name & password as a input.in this file i hav following method public void testSuccessfulLogin() { setConfigFile("/WEB-INF/struts-config.xml"); setRequestPathInfo("/login"); addRequestParameter("username","cdp"); addRequestParameter("password","[EMAIL PROTECTED]"); actionPerform(); String[] actionErrors = {"username.required","password.required"}; verifyActionErrors(actionErrors); } if i run the above test junit window shows that ther r no errors,but shows a warning that WB-INF\web.xml not found does any1 knows why? No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.1.385 / Virus Database: 268.4.5/322 - Release Date: 22/04/2006
Re: StrutsTestCases
A web application that is packed as a war file and deployed to Tomcat or JBoss can work properly without having web.xml. Since you are using struts and jsp. You need tell the server what is the servlet parser as well as someother info. So make sure there is a "VALID" web.xml in your application folder /WEB-INF. On 4/24/06, Chaitanya Parkhi <[EMAIL PROTECTED]> wrote: > > hi guys i hav created a java file by using MockObjectStrutsTestCases which > tests for a simple login form which takes Login Name & password as a > input.in this file i hav following method > > public void testSuccessfulLogin() { > > setConfigFile("/WEB-INF/struts-config.xml"); > > setRequestPathInfo("/login"); > addRequestParameter("username","cdp"); > addRequestParameter("password","[EMAIL PROTECTED]"); > > actionPerform(); > > String[] actionErrors = {"username.required","password.required"}; > verifyActionErrors(actionErrors); > } > > if i run the above test junit window shows that ther r no errors,but > shows > a warning that WB-INF\web.xml not found does any1 knows why? > > -- = The world will be ended if love is everywhere. Shawzi