This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Skip to end of metadata
Go to start of metadata

Frequently Asked Questions

What is MyFaces Test?

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 does not need to be 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?

MyFaces Core uses MyFaces Test for many of its JUnit tests, so take a look at MyFaces Core source code to get an idea how it is used in practice.