|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
org.apache.cactus.internal.AbstractCactusTestCase
org.apache.cactus.ServletTestCase
org.jboss.jsfunit.jsfsession.hellojsf.SimplifiedHelloJSFIntegrationTest
public class SimplifiedHelloJSFIntegrationTest
This is a simplified version of the HelloJSFIntegrationTest. Instead of using HtmlUnit and JSF API's, it uses JSFUnit's JSFClientSession and JSFServerSession classes to do most of the work. JSFSession maintains your HttpSession, so you can do tests that navigate between views. JSFUnit is designed to allow complete integration testing and debugging of JSF applications at the JSF level. In short, it gives you access to the state of the FacesContext and managed beans after every request. With the FacesContext in hand, you are able to do integration testing of JSF applications at the proper level of abstraction. The typical usage pattern of JSFUnit is to submit a request with JSFSession and then examine both the HTML output and JSF internals. The JSFUnit tests below demonstrate testing: - Navigation: "Did this input take me to the correct view?" - View Components: "Does the JSF component tree contain the correct components?" "Do these components have the expected state?" - Managed Beans: "What is the state of my managed beans?" This can include managed beans in Seam-defined scopes such as conversation scope. The tests below only demonstrate request scope, but you can find anything reachable with the EL. - Validation: "Does invalid input generate the proper FacesMessage and error to the user." Tests not shown below: - EL Expressions: You use the Expression Language (EL) to examine the state of your managed beans. JSFUnit allows you to invoke any EL expression. So, it is also possible to use the EL to invoke actions from JSFUnit without submitting a request. This is not deomonstrated below, but it is relatively easy to do. - Application Config: Because you have access to FacesContext, you can also call FacesContext.getApplication(). From there you can test to make sure your application configuration is correct. This would include tests for proper installation of converters, validators, component types, locales, and resource bundles. This class tests the HelloJSF application. This is a simple Hello World application written in JSF with a single managed bean bound to the name "foo" in request scope.
| Field Summary |
|---|
| Fields inherited from class org.apache.cactus.ServletTestCase |
|---|
config, request, response, session |
| Constructor Summary | |
|---|---|
SimplifiedHelloJSFIntegrationTest()
|
|
| Method Summary | |
|---|---|
void |
setUp()
Start a JSFUnit session by getting the /index.faces page. |
static junit.framework.Test |
suite()
|
void |
testGoodbyeButton()
|
void |
testInitialPage()
The initial page was called up in the setUp() method. |
void |
testInputValidation()
|
void |
testValidInput()
This demonstrates how to test managed beans. |
| Methods inherited from class org.apache.cactus.ServletTestCase |
|---|
createProtocolHandler |
| Methods inherited from class org.apache.cactus.internal.AbstractCactusTestCase |
|---|
runBare, runBareServer |
| Methods inherited from class junit.framework.TestCase |
|---|
countTestCases, createResult, getName, run, run, runTest, setName, tearDown, toString |
| Methods inherited from class junit.framework.Assert |
|---|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.apache.cactus.internal.CactusTestCase |
|---|
runBareServer |
| Constructor Detail |
|---|
public SimplifiedHelloJSFIntegrationTest()
| Method Detail |
|---|
public void setUp()
throws IOException
setUp in class junit.framework.TestCaseIOExceptionpublic static junit.framework.Test suite()
public void testInitialPage()
throws IOException
IOException
public void testInputValidation()
throws IOException
IOException
public void testValidInput()
throws IOException
IOException
public void testGoodbyeButton()
throws IOException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||