How to test a JSF application without deploying it to a server?

Hi, I talked a lot about this. I want to test a JSf application without deploying it to a server, so basically I want to run a mock test, like test. I used to use JSFUnit. If possible with JSFUnit itself, HOW TO DO? Is there any other JSF 2.0 testing platform that is easy to use and can simulate a container to run tests without a container? [Along with the names, please also include some guides or sample links] Please help!

+4
source share
2 answers

You can check out the Arquillian Project

You can find the 1 video tutorial on testing JSF applications with Arquillian and Selenium here

+4
source

Updated February 2018: OpenBrace Limited closed and its ObMimic product is no longer supported.

Although this is not specifically designed for JSF testing, the ObMimic library in two instances of the Servlet API may be appropriate.

It provides simple, container-free Java solutions for Servlet API objects that are accurate enough and configurable enough to be able to run the JSF servlet. This allows you to test full GET and POST files on JSF pages without the need to deploy to a server or use a container.

Your tests can create and configure any Servlet API objects for each test (including ServletContext with any necessary resources, mappings, etc.), use them to initialize and call the JSF servlet to process the request, and then to examine the results, your tests also can set JSF PhaseListeners to access the FacesContext and examine any relevant JSF data structures at appropriate points during JSF processing.

The ObMimic website and documentation includes How to Test JSF Pages , which is covered in detail in this, including sample code.

Please note that, as well as testing "real" JSF pages, you can also use this approach with specific JSF pages for testing, which simply call or run any JSF code that you are trying to test (i.e. each test can install any the desired JSF text page in ServletContext, then use the JSF servlet to run it).

+1
source

All Articles