Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The Myfaces Test Framework provides mock object libraries, plus base classes for creating your own JUnit TestCases.

Why should I use it into my JSF project?

First of all, there are two possible strategies to test code:

  1. Testing using Mocks Objects: The objective is provide a simulated environment using mock objects.
  2. In-container testing: In this case the tests are run directly inside the container. Examples of this strategy are Cactus or Arquillian.

MyFaces Test provides a simple simulated JSF or Servlet JUnit environment using mock objects. Given JSF and Servlets are standards, this generic environment is not bound to any JSF or Servlet implementation.

With this environment, you can create quickly JUnit tests for JSF artifacts like managed beans, components, renderers and much more. The resulting tests are small, simple and fast. This framework is used extensively in many MyFaces projects by its simplicity and flexibility.

If you need to do integration testing, the best is use other frameworks designed for that, so please keep in mind use "the right tool for the job". It is a common practice to use MyFaces Test for code logic testing and some functional tests and for other functional and integration tests use other alternatives like htmlunit, selenium and others.

Where I can find examples using MyFaces Test?

...