-
1. Re: Is arquillian the right tool to test a jsf 2.0 application on tomcat 6 that doesn't use CDI?
lfryc Nov 12, 2013 3:04 PM (in response to yersan)1 of 1 people found this helpfulHey yersan,
you don't definitely need to include CDI in order to test JSF.
You can access FacesContext to retrieve your beans,
and there could be an extension which will allow to inject @ManagedProperty (similarly to @Inject in CDI).
However CDI makes in-container testing much easier thanks to type-safe dependency injection.
----
The best tools you can use to test JSF is Warp for anything request/lifecycle oriented.
For functional tests, you can use Drone/Graphene effectively.
And then it depends on your programatic model, what else you could choose.
-
2. Re: Is arquillian the right tool to test a jsf 2.0 application on tomcat 6 that doesn't use CDI?
yersan Nov 12, 2013 3:30 PM (in response to yersan)Hi Lukás,
Then for unit testing I should take a more deeper review to warp, definitelly it will be the way to test the JSF in both client and server sides.
For functional tests, then Drone/Graphene is the correct way but to use them I must use a test server that allows CDI. Because I should inject @Drone and @ArquillianResource in my test files. It seems that this is only possible in a CDI enabled environment.
For this reason, to test my application, I must deploy it in a container with a different configuration than the final productive environment, is this a correct way to test it? Maybe I have different results when the application is deployed on a server with CDI enabled (in case of tomcat I must include a new servlet in the web.xml that is not used by my application apart from other libraries in the classpath) and when it is deployed on a server that doesn't allow CDI, my final productive server, for example.
-
3. Re: Is arquillian the right tool to test a jsf 2.0 application on tomcat 6 that doesn't use CDI?
kpiwko Nov 13, 2013 3:11 AM (in response to yersan)For functional tests, then Drone/Graphene is the correct way but to use them I must use a test server that allows CDI. Because I should inject @Drone and @ArquillianResource in my test files. It seems that this is only possible in a CDI enabled environment.
This is fortunately not true. While @Drone or @ArquillianResource follow CDI model, injection is handled by Arquillian itself and works in any environment. For instance, you can even inject @Drone when running without container.
Hope that helps,
Karel
-
4. Re: Is arquillian the right tool to test a jsf 2.0 application on tomcat 6 that doesn't use CDI?
yersan Nov 13, 2013 4:22 AM (in response to kpiwko)Hi Karel, this is a good new for me.
Yes, I have found an example in https://github.com/arquillian/arquillian-showcase that use tomcat without CDI and @ArquillianResource. I will try to use it to create an example using @Drone since I have found any sample of drone + tomcat 6 without CDI
Ok, thanks both, then it seems arquillian can be used with a tomcat 6 without CDI enabled, for unit test, use wrap, for functional/integration drone and graphene.