You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Ryan Cuprak <rc...@mac.com> on 2008/10/13 06:08:06 UTC
Excluding a runtime dependency during testing
Hello,
Does anyone know how to exclude a runtime dependency from the test
classpath? I am using RichFaces and TestNG. When I run my Seam TestNG
tests RichFaces tries to perform some operations which causes a test
to fail. I want RichFaces dependencies in my war file but I don't want
them added to the classpath when running tests.
Thanks!
-Ryan
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: Excluding a runtime dependency during testing
Posted by "Brian E. Fox" <br...@reply.infinity.nu>.
Hi Ryan,
To get web.xml on your test classpath, you should copy it to
/src/test/resources/web.xml.
-----Original Message-----
From: Ryan Cuprak [mailto:rcuprak@mac.com]
Sent: Monday, October 13, 2008 8:23 PM
To: Maven Users List
Subject: Re: Excluding a runtime dependency during testing
Thanks,
Below is the exception - I have come across two solutions on the web:
1. remove RichFaces from the test classpath (from what you have said
and my own research this isn't possible - also not a good long term
solution)
2. add web.xml to the test classpath
I am not sure about how to add web.xml to the test classpath - right
now it resides under the src/main/webapp/WEB-INF.
I have cross posted on the Seam discussion board. It baffles me why
adding a new jar to my project would suddenly cause this problem. The
test case prints "Hello World" and doesn't invoke any RichFaces
classes. Digging into the source now.
Exception:
javax.servlet.ServletException: ServletContext not allow to
getResourceAsStream for /WEB-INF/web.xml
at org.ajax4jsf.webapp.WebXml.init(WebXml.java:131) at
org
.ajax4jsf
.resource.InternetResourceService.init(InternetResourceService.java:
130) at org.ajax4jsf.webapp.BaseFilter.init(BaseFilter.java:181) at
org.jboss.seam.web.Ajax4jsfFilter.init(Ajax4jsfFilter.java:82) at
org.jboss.seam.servlet.SeamFilter.init(SeamFilter.java:97) at
org
.jboss
.seam.mock.AbstractSeamTest.createSeamFilter(AbstractSeamTest.java:
976) at
org.jboss.seam.mock.AbstractSeamTest.setupClass(AbstractSeamTest.java:
953) at org.jboss.seam.mock.SeamTest.setupClass(SeamTest.java:44) at
org
.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:
62) at
org
.apache
.maven
.surefire
.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:
141) at org.apache.maven.surefire.Surefire.run(Surefire.java:177) at
org
.apache
.maven
.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:
345) at
org
.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:
1009)
On Oct 13, 2008, at 4:02 AM, Baptiste MATHUS wrote:
> Hi Ryan,
>
> I don't think it's possible. Maybe you could manually try removing the
> dependency to understand what's the cause of your problem.
> If RichFaces is doing something under the cover that causes the test
> to
> fail, it seems to be a bad strategy not to try to tackle it
> directltly.
> Trying to workaround it by excluding it when testing could backfire
> when in
> prod, imo.
>
> Just a thought : couldn't your problem come from a dependency coming
> from
> TestNg or RichFaces that makes running themselves together
> problematic/incompatible?
>
> Cheers.
>
> 2008/10/13 Ryan Cuprak <rc...@mac.com>
>
>> Hello,
>> Does anyone know how to exclude a runtime dependency from the test
>> classpath? I am using RichFaces and TestNG. When I run my Seam
>> TestNG tests
>> RichFaces tries to perform some operations which causes a test to
>> fail. I
>> want RichFaces dependencies in my war file but I don't want them
>> added to
>> the classpath when running tests.
>>
>> Thanks!
>> -Ryan
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>
>
> --
> Baptiste <Batmat> MATHUS - http://batmat.net
> Sauvez un arbre,
> Mangez un castor !
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Excluding a runtime dependency during testing
Posted by Stephen Connolly <st...@gmail.com>.
I suspect it will be by adding the file to some sub-folder of src/tes/resources
perhaps src/test/resources/WEB-INF/web.xml but you may need to play around a bit
-Stephen
2008/10/14 Ryan Cuprak <rc...@mac.com>:
>
> Thanks,
> Below is the exception - I have come across two solutions on the web:
> 1. remove RichFaces from the test classpath (from what you have said and my
> own research this isn't possible - also not a good long term solution)
> 2. add web.xml to the test classpath
>
> I am not sure about how to add web.xml to the test classpath - right now it
> resides under the src/main/webapp/WEB-INF.
>
> I have cross posted on the Seam discussion board. It baffles me why adding
> a new jar to my project would suddenly cause this problem. The test case
> prints "Hello World" and doesn't invoke any RichFaces classes. Digging into
> the source now.
>
> Exception:
> javax.servlet.ServletException: ServletContext not allow to
> getResourceAsStream for /WEB-INF/web.xml
> at org.ajax4jsf.webapp.WebXml.init(WebXml.java:131) at
> org.ajax4jsf.resource.InternetResourceService.init(InternetResourceService.java:130)
> at org.ajax4jsf.webapp.BaseFilter.init(BaseFilter.java:181) at
> org.jboss.seam.web.Ajax4jsfFilter.init(Ajax4jsfFilter.java:82) at
> org.jboss.seam.servlet.SeamFilter.init(SeamFilter.java:97) at
> org.jboss.seam.mock.AbstractSeamTest.createSeamFilter(AbstractSeamTest.java:976)
> at
> org.jboss.seam.mock.AbstractSeamTest.setupClass(AbstractSeamTest.java:953)
> at org.jboss.seam.mock.SeamTest.setupClass(SeamTest.java:44) at
> org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:62)
> at
> org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:141)
> at org.apache.maven.surefire.Surefire.run(Surefire.java:177) at
> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
> at
> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
>
> On Oct 13, 2008, at 4:02 AM, Baptiste MATHUS wrote:
>
>> Hi Ryan,
>>
>> I don't think it's possible. Maybe you could manually try removing the
>> dependency to understand what's the cause of your problem.
>> If RichFaces is doing something under the cover that causes the test to
>> fail, it seems to be a bad strategy not to try to tackle it directltly.
>> Trying to workaround it by excluding it when testing could backfire when
>> in
>> prod, imo.
>>
>> Just a thought : couldn't your problem come from a dependency coming from
>> TestNg or RichFaces that makes running themselves together
>> problematic/incompatible?
>>
>> Cheers.
>>
>> 2008/10/13 Ryan Cuprak <rc...@mac.com>
>>
>>> Hello,
>>> Does anyone know how to exclude a runtime dependency from the test
>>> classpath? I am using RichFaces and TestNG. When I run my Seam TestNG
>>> tests
>>> RichFaces tries to perform some operations which causes a test to fail. I
>>> want RichFaces dependencies in my war file but I don't want them added to
>>> the classpath when running tests.
>>>
>>> Thanks!
>>> -Ryan
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>
>>
>> --
>> Baptiste <Batmat> MATHUS - http://batmat.net
>> Sauvez un arbre,
>> Mangez un castor !
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Excluding a runtime dependency during testing
Posted by Ryan Cuprak <rc...@mac.com>.
Thanks,
Below is the exception - I have come across two solutions on the web:
1. remove RichFaces from the test classpath (from what you have said
and my own research this isn't possible - also not a good long term
solution)
2. add web.xml to the test classpath
I am not sure about how to add web.xml to the test classpath - right
now it resides under the src/main/webapp/WEB-INF.
I have cross posted on the Seam discussion board. It baffles me why
adding a new jar to my project would suddenly cause this problem. The
test case prints "Hello World" and doesn't invoke any RichFaces
classes. Digging into the source now.
Exception:
javax.servlet.ServletException: ServletContext not allow to
getResourceAsStream for /WEB-INF/web.xml
at org.ajax4jsf.webapp.WebXml.init(WebXml.java:131) at
org
.ajax4jsf
.resource.InternetResourceService.init(InternetResourceService.java:
130) at org.ajax4jsf.webapp.BaseFilter.init(BaseFilter.java:181) at
org.jboss.seam.web.Ajax4jsfFilter.init(Ajax4jsfFilter.java:82) at
org.jboss.seam.servlet.SeamFilter.init(SeamFilter.java:97) at
org
.jboss
.seam.mock.AbstractSeamTest.createSeamFilter(AbstractSeamTest.java:
976) at
org.jboss.seam.mock.AbstractSeamTest.setupClass(AbstractSeamTest.java:
953) at org.jboss.seam.mock.SeamTest.setupClass(SeamTest.java:44) at
org
.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:
62) at
org
.apache
.maven
.surefire
.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:
141) at org.apache.maven.surefire.Surefire.run(Surefire.java:177) at
org
.apache
.maven
.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:
345) at
org
.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:
1009)
On Oct 13, 2008, at 4:02 AM, Baptiste MATHUS wrote:
> Hi Ryan,
>
> I don't think it's possible. Maybe you could manually try removing the
> dependency to understand what's the cause of your problem.
> If RichFaces is doing something under the cover that causes the test
> to
> fail, it seems to be a bad strategy not to try to tackle it
> directltly.
> Trying to workaround it by excluding it when testing could backfire
> when in
> prod, imo.
>
> Just a thought : couldn't your problem come from a dependency coming
> from
> TestNg or RichFaces that makes running themselves together
> problematic/incompatible?
>
> Cheers.
>
> 2008/10/13 Ryan Cuprak <rc...@mac.com>
>
>> Hello,
>> Does anyone know how to exclude a runtime dependency from the test
>> classpath? I am using RichFaces and TestNG. When I run my Seam
>> TestNG tests
>> RichFaces tries to perform some operations which causes a test to
>> fail. I
>> want RichFaces dependencies in my war file but I don't want them
>> added to
>> the classpath when running tests.
>>
>> Thanks!
>> -Ryan
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>
>
> --
> Baptiste <Batmat> MATHUS - http://batmat.net
> Sauvez un arbre,
> Mangez un castor !
Re: Excluding a runtime dependency during testing
Posted by Baptiste MATHUS <ml...@batmat.net>.
Hi Ryan,
I don't think it's possible. Maybe you could manually try removing the
dependency to understand what's the cause of your problem.
If RichFaces is doing something under the cover that causes the test to
fail, it seems to be a bad strategy not to try to tackle it directltly.
Trying to workaround it by excluding it when testing could backfire when in
prod, imo.
Just a thought : couldn't your problem come from a dependency coming from
TestNg or RichFaces that makes running themselves together
problematic/incompatible?
Cheers.
2008/10/13 Ryan Cuprak <rc...@mac.com>
> Hello,
> Does anyone know how to exclude a runtime dependency from the test
> classpath? I am using RichFaces and TestNG. When I run my Seam TestNG tests
> RichFaces tries to perform some operations which causes a test to fail. I
> want RichFaces dependencies in my war file but I don't want them added to
> the classpath when running tests.
>
> Thanks!
> -Ryan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
--
Baptiste <Batmat> MATHUS - http://batmat.net
Sauvez un arbre,
Mangez un castor !