You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bu...@apache.org on 2014/03/04 06:29:54 UTC

svn commit: r899947 - in /websites/staging/myfaces/trunk/content: ./ wiki/core/user-guide/jsf-and-myfaces-howtos/ wiki/core/user-guide/jsf-and-myfaces-howtos/unit-testing/

Author: buildbot
Date: Tue Mar  4 05:29:53 2014
New Revision: 899947

Log:
Staging update by buildbot for myfaces

Added:
    websites/staging/myfaces/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/unit-testing/
    websites/staging/myfaces/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/unit-testing.html
    websites/staging/myfaces/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/unit-testing/create-test-from-base-class.html
    websites/staging/myfaces/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/unit-testing/create-test-junit-runner.html
    websites/staging/myfaces/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/unit-testing/setup-with-maven.html
Modified:
    websites/staging/myfaces/trunk/content/   (props changed)

Propchange: websites/staging/myfaces/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Tue Mar  4 05:29:53 2014
@@ -1 +1 @@
-1572399
+1573858

Added: websites/staging/myfaces/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/unit-testing.html
==============================================================================
--- websites/staging/myfaces/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/unit-testing.html (added)
+++ websites/staging/myfaces/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/unit-testing.html Tue Mar  4 05:29:53 2014
@@ -0,0 +1,331 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE- 2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+  <head>
+    <title>Unit Testing</title>
+    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
+    
+    <link rel="stylesheet" type="text/css" media="all" href="/wiki/css/maven-base.css"/>
+    <link rel="stylesheet" type="text/css" media="all" href="/wiki/css/maven-theme.css"/>
+    <link rel="stylesheet" type="text/css" media="all" href="/wiki/css/codehilite.css"/>
+    <link rel="stylesheet" type="text/css" media="print" href="/wiki/css/print.css"/>
+    
+    
+
+    
+    <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file to you under the Apache License, Version 2.0 (the &quot;License&quot;); you may not use this file except in compliance with the License.  You may obtain a copy of the License at . http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the specific language governing permissions and limitations under the License. -->
+  </head>
+  <body>
+  <div id="header">
+    <div id="top_menu">
+      <div id="top_menu_container">
+          <!-- #simplePublishDate($decoration.publishDate)
+          #links( $decoration.body.links ) -->
+          <div class="date">
+            Last Published: <script>document.write(document.lastModified);</script>
+          </div>
+          <ul>
+<li><a href="http://www.apache.org/">Apache</a></li>
+<li><a href="http://myfaces.apache.org/index.html">MyFaces</a></li>
+<li><a href="/wiki/core/user-guide/quick-start.html">Quick Start</a></li>
+<li><a href="/wiki/core/user-guide.html">User Guide</a></li>
+<li><a href="/wiki/core/faq.html">FAQ</a></li>
+<li><a href="http://myfaces.apache.org/core22/javadoc.html">Generated Doc</a></li>
+<li><a href="http://myfaces.apache.org/download.html">Download</a></li>
+</ul>
+        <div class="clear"></div>
+      </div> <!-- close top_menu_container -->
+    </div> <!-- close top_menu -->
+    <div id="header_bottom">
+    <div id="logo_banner_container">
+      <!--#banner( $decoration.bannerLeft "logo" )-->
+      <div id="logo">
+        <a href="index.html">
+          <img src="/wiki/img/banners/MyFaces_logo.jpg" alt="" />
+        </a>
+      </div>
+      <!--#banner( $decoration.bannerRight "banner" )-->
+      <div id="banner">
+        <a href="http://www.apache.org/">
+          <img src="/wiki/img/banners/apache_banner.png" alt="" />
+        </a>
+      </div>    
+      <div class="clear"></div>
+    </div> <!-- close logo_banner_container -->
+    </div> <!-- close header_bottom -->
+  </div> <!-- close header -->
+    <div id="main_container">
+    <div id="left_column">
+        <div class="left_menu_top">
+<div class="left_menu_bottom">
+    <h5>JSF Implementations</h5>
+    <div class="content">
+        <ul class="left_menu">
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/core22/index.html">Core JSF-2.2</a>
+            </li>
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/core21/index.html">Core JSF-2.1</a>
+            </li>
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/core20/index.html">Core JSF-2.0</a>
+            </li>
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/core12/index.html">Core JSF-1.2</a>
+            </li>
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/core11/index.html">Core JSF-1.1</a>
+            </li>
+        </ul>
+    </div>
+</div><!-- close left_menu_bottom -->
+</div>
+
+<!-- close left_menu_top -->
+
+<div class="left_menu_top">
+<div class="left_menu_bottom">
+    <h5>UI-Component Sets</h5>
+    <div class="content">
+        <ul class="left_menu">
+            <li class="none">
+                <a href="http://myfaces.apache.org/trinidad/index.html">Trinidad</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/tobago/index.html">Tobago</a>
+            </li>
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/tomahawk/index.html">Tomahawk</a>
+            </li>
+        </ul>
+    </div><!-- close content -->
+</div><!-- close left_menu_bottom -->
+</div>
+
+<!-- close left_menu_top -->
+
+<div class="left_menu_top">
+<div class="left_menu_bottom">
+    <h5>Add-ons and Extensions</h5>
+    <div class="content">
+        <ul class="left_menu">
+            <li class="none">
+                <a href="http://myfaces.apache.org/extensions/cdi/index.html">CODI</a>
+            </li>
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/orchestra/index.html">Orchestra</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/extensions/validator/index.html">ExtVal</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/portlet-bridge/index.html">Portlet Bridge</a>
+            </li>
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/test/index.html">Test</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/commons/index.html">Commons</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/extensions/scripting/index.html">Ext-Scripting</a>
+            </li>
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/sandbox/index.html">Sandbox</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/otherProjects.html">Others</a>
+            </li>
+        </ul>
+    </div><!-- close content -->
+</div><!-- close left_menu_bottom -->
+</div>
+
+<!-- close left_menu_top -->
+
+<div class="left_menu_top">
+<div class="left_menu_bottom">
+    <h5>Project Documentation</h5>
+    <div class="content">
+        <ul class="left_menu">
+            <li class="none">
+                <a href="http://myfaces.apache.org/docindex.html">Documentation Index</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/jsfintro.html">JSF Intro</a>
+            </li>
+            <li class="none">
+                <a href="/wiki/core/user-guide/quick-start.html" class="externalLink">Quick Start<span/></a>
+            </li>
+            <li class="none">
+                <a href="/wiki/core/user-guide/getting-started.html" class="externalLink">Getting Started<span/></a>
+            </li>
+            <li class="none">
+                <a href="/wiki/core/faq.html" class="externalLink">FAQ<span/></a>
+            </li>
+            <li class="none">
+                <a href="https://cwiki.apache.org/confluence/display/MYFACES/Index" class="externalLink">Confluence Wiki<span/></a>
+            </li>
+            <li class="none">
+                <a href="http://wiki.apache.org/myfaces" class="externalLink">Public Wiki<span/></a>
+            </li>
+            <li class="none">
+                <a href="http://wiki.apache.org/myfaces/CompatibilityMatrix" class="externalLink">Compatibility<span/></a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/integration.html">Continuous Integration</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/issues.html">Issue Tracking</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/mail-lists.html">Mailing Lists</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/license.html">Project License</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/project-summary.html">Project Summary</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/team-list.html">Project Team</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/source-repository.html">Source Repository</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/index.html" class="selected">About</a>
+            </li>
+        </ul>
+    </div><!-- close content -->
+</div><!-- close left_menu_bottom -->
+</div>
+
+<!-- close left_menu_top -->
+
+<div class="left_menu_top">
+<div class="left_menu_bottom">
+    <h5>Foundation</h5>
+    <div class="content">
+        <ul class="left_menu">
+            <li class="none">
+                <a href="http://www.apache.org/" class="externalLink">ASF<span/></a>
+            </li>
+            <li class="none">
+                <a href="http://www.apache.org/foundation/sponsorship.html" class="externalLink">Sponsorship<span/></a>
+            </li>
+            <li class="none">
+                <a href="http://www.apache.org/foundation/thanks.html" class="externalLink">Thanks<span/></a>
+            </li>
+            <li class="none">
+                <a href="http://www.apache.org/security/" class="externalLink">Security<span/></a>
+            </li>
+            <li class="none">
+                <a href="http://www.apache.org/licenses/" class="externalLink">License<span/></a>
+            </li>
+        </ul>
+    </div><!-- close content -->
+</div><!-- close left_menu_bottom -->
+</div>
+
+<!-- close left_menu_top -->
+    <!--
+       #mainMenu( $decoration.body.menus )
+       #poweredByLogo( $decoration.poweredBy )
+       -->
+        <div id="powered_by">
+          <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
+            <img alt="Built by Maven" src="/wiki/img/banners/maven-feather.png"></img>
+          </a>
+        </div>
+    </div>
+    <div id="body_column">
+      <div>
+      <p><a href="/">Home</a>&nbsp;&raquo&nbsp;<a href="/wiki/">Wiki</a>&nbsp;&raquo&nbsp;<a href="/wiki/core.html">MyFaces Core</a>&nbsp;&raquo&nbsp;<a href="/wiki/core/user-guide.html">MyFaces Core User Guide</a>&nbsp;&raquo&nbsp;<a href="/wiki/core/user-guide/jsf-and-myfaces-howtos.html">JSF and MyFaces Howtos</a></p>
+      <h2>Unit Testing</h2>
+      <div id="content" class="grid_16"><div class="section-content"><div class="codehilite"><pre>
+</pre></div>
+
+
+<p>There are multiple strategies to deal with Unit Testing when you are using
+MyFaces, but over the time we have identified two possible alternatives.</p>
+<ol>
+<li>MyFaces Test: unit testing using predefined mock objects for JSF 
+    artifacts. See <a href="http://myfaces.apache.org/test/index.html">MyFaces Test Homepage</a></li>
+<li>MyFaces Core Test Impl Module (new feature since 2.2.1): run a full 
+    MyFaces Core instance inside a JUnit 4 Test using a runner 
+    or an already initialized base class. In this mode it is also
+    possible to run JSF + CDI.</li>
+</ol>
+<p>The recommended strategy when you are creating your own unit tests is first
+define the scenario to test and then identify the right tool for the job.
+Let's see when and how each option works.</p>
+<h2 id="using-myfaces-test">Using MyFaces Test</h2>
+<p>If you are testing some methods in a JSF managed bean or a CDI bean, or
+if you need to check if a Validator or Converter works, possibly the 
+only thing you need is a dummy FacesContext instance and an environment
+where the beans lives. In that case, MyFaces Test provide some base 
+classes for your JUnit tests or if you need more flexibility
+it also has a class that encapsulates a mocked container. See
+org.apache.myfaces.test.mock.MockedJsfTestContainer for details. 
+If you are using CDI, there are different options out there 
+to run a CDI container inside a JUnit test that can be mixed with
+MyFaces Test. </p>
+<p>See <a href="http://myfaces.apache.org/test/index.html">MyFaces Test Homepage</a> for
+more information about how to use this library.</p>
+<h2 id="myfaces-core-test-impl-module">MyFaces Core Test Impl Module</h2>
+<p>If you need to validate some behavior that is bound to the JSF lifecycle,
+for example create a view like in a real request, input some values and 
+click on a submit button, or check the view structure, or check
+the navigation algorithm, or check the interaction between your JSF views
+and your beans, then you need a JSF test environment that can be as 
+close as possible to the real one in your web application running 
+in a web server.</p>
+<p>In this case, the interest resides on test a complex server side logic and
+forget about the client side, which is usually encapsulated by the
+JSF component. If you need a full simulation you are probably looking 
+for functional testing, and in that case, tools like Arquillian,
+Selenium or Cargo + HtmlUnit can help you better.</p>
+<p>MyFaces Core Test Impl Module helps you to run MyFaces Core inside a JUnit 
+Test using a mocked servlet environment. The idea is "simulate" the 
+effect of the rendered html markup and javascript using a MockMyFacesClient
+which manipulates a ServletMockContainer and add the necessary request
+parameters in the same way as a web browser sends an HTTP request and
+then the web container decodes. If you are using a third party JSF 
+component library, it is easy to ceate a custom client class taking 
+MockMyFacesClient as base model and checking how HTTP requests are filled
+by a real web browser.</p>
+<p>Below you can find more information about how to use this library.</p>
+<ul>
+<li><a href="/wiki/core/user-guide/jsf-and-myfaces-howtos/unit-testing/create-test-from-base-class.html">Create Test from Base Class</a></li>
+<li><a href="/wiki/core/user-guide/jsf-and-myfaces-howtos/unit-testing/create-test-junit-runner.html">Create Test using JUnit Runner</a></li>
+<li><a href="/wiki/core/user-guide/jsf-and-myfaces-howtos/unit-testing/setup-with-maven.html">Setup Test Environment with Maven</a></li>
+</ul></div></div>
+      </div>
+    </div>
+    <div class="clear"></div>
+    </div> <!-- close main container -->
+    <div id="footer">
+      <div class="copyright">
+      Copyright &#169; Apache Software Foundation, Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.<br/>
+       Apache MyFaces, Apache Tobago, Apache, the Apache feather logo, and the Apache MyFaces project logos are trademarks of The Apache Software Foundation.
+      </div><!-- close copyright -->
+    </div><!-- close footer -->
+  </body>
+</html>

Added: websites/staging/myfaces/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/unit-testing/create-test-from-base-class.html
==============================================================================
--- websites/staging/myfaces/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/unit-testing/create-test-from-base-class.html (added)
+++ websites/staging/myfaces/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/unit-testing/create-test-from-base-class.html Tue Mar  4 05:29:53 2014
@@ -0,0 +1,323 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE- 2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+  <head>
+    <title>Create Test from Base Class</title>
+    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
+    
+    <link rel="stylesheet" type="text/css" media="all" href="/wiki/css/maven-base.css"/>
+    <link rel="stylesheet" type="text/css" media="all" href="/wiki/css/maven-theme.css"/>
+    <link rel="stylesheet" type="text/css" media="all" href="/wiki/css/codehilite.css"/>
+    <link rel="stylesheet" type="text/css" media="print" href="/wiki/css/print.css"/>
+    
+    
+
+    
+    <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file to you under the Apache License, Version 2.0 (the &quot;License&quot;); you may not use this file except in compliance with the License.  You may obtain a copy of the License at . http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the specific language governing permissions and limitations under the License. -->
+  </head>
+  <body>
+  <div id="header">
+    <div id="top_menu">
+      <div id="top_menu_container">
+          <!-- #simplePublishDate($decoration.publishDate)
+          #links( $decoration.body.links ) -->
+          <div class="date">
+            Last Published: <script>document.write(document.lastModified);</script>
+          </div>
+          <ul>
+<li><a href="http://www.apache.org/">Apache</a></li>
+<li><a href="http://myfaces.apache.org/index.html">MyFaces</a></li>
+<li><a href="/wiki/core/user-guide/quick-start.html">Quick Start</a></li>
+<li><a href="/wiki/core/user-guide.html">User Guide</a></li>
+<li><a href="/wiki/core/faq.html">FAQ</a></li>
+<li><a href="http://myfaces.apache.org/core22/javadoc.html">Generated Doc</a></li>
+<li><a href="http://myfaces.apache.org/download.html">Download</a></li>
+</ul>
+        <div class="clear"></div>
+      </div> <!-- close top_menu_container -->
+    </div> <!-- close top_menu -->
+    <div id="header_bottom">
+    <div id="logo_banner_container">
+      <!--#banner( $decoration.bannerLeft "logo" )-->
+      <div id="logo">
+        <a href="index.html">
+          <img src="/wiki/img/banners/MyFaces_logo.jpg" alt="" />
+        </a>
+      </div>
+      <!--#banner( $decoration.bannerRight "banner" )-->
+      <div id="banner">
+        <a href="http://www.apache.org/">
+          <img src="/wiki/img/banners/apache_banner.png" alt="" />
+        </a>
+      </div>    
+      <div class="clear"></div>
+    </div> <!-- close logo_banner_container -->
+    </div> <!-- close header_bottom -->
+  </div> <!-- close header -->
+    <div id="main_container">
+    <div id="left_column">
+        <div class="left_menu_top">
+<div class="left_menu_bottom">
+    <h5>JSF Implementations</h5>
+    <div class="content">
+        <ul class="left_menu">
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/core22/index.html">Core JSF-2.2</a>
+            </li>
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/core21/index.html">Core JSF-2.1</a>
+            </li>
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/core20/index.html">Core JSF-2.0</a>
+            </li>
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/core12/index.html">Core JSF-1.2</a>
+            </li>
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/core11/index.html">Core JSF-1.1</a>
+            </li>
+        </ul>
+    </div>
+</div><!-- close left_menu_bottom -->
+</div>
+
+<!-- close left_menu_top -->
+
+<div class="left_menu_top">
+<div class="left_menu_bottom">
+    <h5>UI-Component Sets</h5>
+    <div class="content">
+        <ul class="left_menu">
+            <li class="none">
+                <a href="http://myfaces.apache.org/trinidad/index.html">Trinidad</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/tobago/index.html">Tobago</a>
+            </li>
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/tomahawk/index.html">Tomahawk</a>
+            </li>
+        </ul>
+    </div><!-- close content -->
+</div><!-- close left_menu_bottom -->
+</div>
+
+<!-- close left_menu_top -->
+
+<div class="left_menu_top">
+<div class="left_menu_bottom">
+    <h5>Add-ons and Extensions</h5>
+    <div class="content">
+        <ul class="left_menu">
+            <li class="none">
+                <a href="http://myfaces.apache.org/extensions/cdi/index.html">CODI</a>
+            </li>
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/orchestra/index.html">Orchestra</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/extensions/validator/index.html">ExtVal</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/portlet-bridge/index.html">Portlet Bridge</a>
+            </li>
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/test/index.html">Test</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/commons/index.html">Commons</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/extensions/scripting/index.html">Ext-Scripting</a>
+            </li>
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/sandbox/index.html">Sandbox</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/otherProjects.html">Others</a>
+            </li>
+        </ul>
+    </div><!-- close content -->
+</div><!-- close left_menu_bottom -->
+</div>
+
+<!-- close left_menu_top -->
+
+<div class="left_menu_top">
+<div class="left_menu_bottom">
+    <h5>Project Documentation</h5>
+    <div class="content">
+        <ul class="left_menu">
+            <li class="none">
+                <a href="http://myfaces.apache.org/docindex.html">Documentation Index</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/jsfintro.html">JSF Intro</a>
+            </li>
+            <li class="none">
+                <a href="/wiki/core/user-guide/quick-start.html" class="externalLink">Quick Start<span/></a>
+            </li>
+            <li class="none">
+                <a href="/wiki/core/user-guide/getting-started.html" class="externalLink">Getting Started<span/></a>
+            </li>
+            <li class="none">
+                <a href="/wiki/core/faq.html" class="externalLink">FAQ<span/></a>
+            </li>
+            <li class="none">
+                <a href="https://cwiki.apache.org/confluence/display/MYFACES/Index" class="externalLink">Confluence Wiki<span/></a>
+            </li>
+            <li class="none">
+                <a href="http://wiki.apache.org/myfaces" class="externalLink">Public Wiki<span/></a>
+            </li>
+            <li class="none">
+                <a href="http://wiki.apache.org/myfaces/CompatibilityMatrix" class="externalLink">Compatibility<span/></a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/integration.html">Continuous Integration</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/issues.html">Issue Tracking</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/mail-lists.html">Mailing Lists</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/license.html">Project License</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/project-summary.html">Project Summary</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/team-list.html">Project Team</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/source-repository.html">Source Repository</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/index.html" class="selected">About</a>
+            </li>
+        </ul>
+    </div><!-- close content -->
+</div><!-- close left_menu_bottom -->
+</div>
+
+<!-- close left_menu_top -->
+
+<div class="left_menu_top">
+<div class="left_menu_bottom">
+    <h5>Foundation</h5>
+    <div class="content">
+        <ul class="left_menu">
+            <li class="none">
+                <a href="http://www.apache.org/" class="externalLink">ASF<span/></a>
+            </li>
+            <li class="none">
+                <a href="http://www.apache.org/foundation/sponsorship.html" class="externalLink">Sponsorship<span/></a>
+            </li>
+            <li class="none">
+                <a href="http://www.apache.org/foundation/thanks.html" class="externalLink">Thanks<span/></a>
+            </li>
+            <li class="none">
+                <a href="http://www.apache.org/security/" class="externalLink">Security<span/></a>
+            </li>
+            <li class="none">
+                <a href="http://www.apache.org/licenses/" class="externalLink">License<span/></a>
+            </li>
+        </ul>
+    </div><!-- close content -->
+</div><!-- close left_menu_bottom -->
+</div>
+
+<!-- close left_menu_top -->
+    <!--
+       #mainMenu( $decoration.body.menus )
+       #poweredByLogo( $decoration.poweredBy )
+       -->
+        <div id="powered_by">
+          <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
+            <img alt="Built by Maven" src="/wiki/img/banners/maven-feather.png"></img>
+          </a>
+        </div>
+    </div>
+    <div id="body_column">
+      <div>
+      <p><a href="/">Home</a>&nbsp;&raquo&nbsp;<a href="/wiki/">Wiki</a>&nbsp;&raquo&nbsp;<a href="/wiki/core.html">MyFaces Core</a>&nbsp;&raquo&nbsp;<a href="/wiki/core/user-guide.html">MyFaces Core User Guide</a>&nbsp;&raquo&nbsp;<a href="/wiki/core/user-guide/jsf-and-myfaces-howtos.html">JSF and MyFaces Howtos</a>&nbsp;&raquo&nbsp;<a href="/wiki/core/user-guide/jsf-and-myfaces-howtos/unit-testing.html">Unit Testing</a></p>
+      <h2>Create Test from Base Class</h2>
+      <div id="content" class="grid_16"><div class="section-content"><p>First create a test class that extends from:</p>
+<ul>
+<li>org.apache.myfaces.mc.test.core.AbstractMyFacesRequestTestCase</li>
+<li>org.apache.myfaces.mc.test.core.AbstractMyFacesCDIRequestTestCase (Use Apache OpenWebbeans)</li>
+</ul>
+<p>For example</p>
+<div class="codehilite"><pre><span class="kd">public</span> <span class="kd">class</span> <span class="nc">SimpleTestCase</span> <span class="kd">extends</span> <span class="n">AbstractMyFacesCDIRequestTestCase</span>
+<span class="o">{</span>
+    <span class="nd">@Inject</span>
+    <span class="nd">@Named</span><span class="o">(</span><span class="s">&quot;helloWorld&quot;</span><span class="o">)</span>
+    <span class="kd">private</span> <span class="n">HelloWorldController</span> <span class="n">helloWorldBean</span><span class="o">;</span>
+
+    <span class="nd">@Test</span>
+    <span class="kd">public</span> <span class="kt">void</span> <span class="nf">testHelloWorld</span><span class="o">()</span> <span class="kd">throws</span> <span class="n">Exception</span>
+    <span class="o">{</span>
+        <span class="n">startViewRequest</span><span class="o">(</span><span class="s">&quot;/helloWorld.xhtml&quot;</span><span class="o">);</span>
+        <span class="n">processLifecycleExecute</span><span class="o">();</span>
+        <span class="n">Assert</span><span class="o">.</span><span class="na">assertEquals</span><span class="o">(</span><span class="s">&quot;page2.xhtml&quot;</span><span class="o">,</span> <span class="n">helloWorldBean</span><span class="o">.</span><span class="na">send</span><span class="o">());</span>
+        <span class="n">renderResponse</span><span class="o">();</span>
+
+        <span class="n">client</span><span class="o">.</span><span class="na">inputText</span><span class="o">(</span><span class="s">&quot;mainForm:name&quot;</span><span class="o">,</span> <span class="s">&quot;John Smith&quot;</span><span class="o">);</span>
+        <span class="c1">// The button end current request and start a new request </span>
+        <span class="c1">// with a simulated submit </span>
+        <span class="n">client</span><span class="o">.</span><span class="na">submit</span><span class="o">(</span><span class="s">&quot;mainForm:submit&quot;</span><span class="o">);</span>
+
+        <span class="n">processLifecycleExecute</span><span class="o">();</span>
+        <span class="n">Assert</span><span class="o">.</span><span class="na">assertEquals</span><span class="o">(</span><span class="s">&quot;John Smith&quot;</span><span class="o">,</span> <span class="n">helloWorldBean</span><span class="o">.</span><span class="na">getName</span><span class="o">());</span>
+        <span class="n">Assert</span><span class="o">.</span><span class="na">assertEquals</span><span class="o">(</span><span class="s">&quot;/page2.xhtml&quot;</span><span class="o">,</span> <span class="n">facesContext</span><span class="o">.</span><span class="na">getViewRoot</span><span class="o">().</span><span class="na">getViewId</span><span class="o">());</span>
+        <span class="n">endRequest</span><span class="o">();</span>
+    <span class="o">}</span>
+
+    <span class="nd">@Override</span>
+    <span class="kd">protected</span> <span class="n">ExpressionFactory</span> <span class="nf">createExpressionFactory</span><span class="o">()</span>
+    <span class="o">{</span>
+        <span class="k">return</span> <span class="k">new</span> <span class="n">com</span><span class="o">.</span><span class="na">sun</span><span class="o">.</span><span class="na">el</span><span class="o">.</span><span class="na">ExpressionFactoryImpl</span><span class="o">();</span>
+    <span class="o">}</span>
+
+    <span class="nd">@Override</span>
+    <span class="kd">protected</span> <span class="n">String</span> <span class="nf">getWebappResourcePath</span><span class="o">()</span>
+    <span class="o">{</span>
+        <span class="k">return</span> <span class="s">&quot;webapp&quot;</span><span class="o">;</span>
+    <span class="o">}</span>
+<span class="o">}</span>
+</pre></div>
+
+
+<p>The method getWebappResourcePath() defines where in the test classpath are the pages
+to load. createExpressionFactory() defines the EL Expression factory used. There are
+many examples available in MyFaces Core 2.2.x impl module, so just take a look and
+the code.</p></div></div>
+      </div>
+    </div>
+    <div class="clear"></div>
+    </div> <!-- close main container -->
+    <div id="footer">
+      <div class="copyright">
+      Copyright &#169; Apache Software Foundation, Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.<br/>
+       Apache MyFaces, Apache Tobago, Apache, the Apache feather logo, and the Apache MyFaces project logos are trademarks of The Apache Software Foundation.
+      </div><!-- close copyright -->
+    </div><!-- close footer -->
+  </body>
+</html>

Added: websites/staging/myfaces/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/unit-testing/create-test-junit-runner.html
==============================================================================
--- websites/staging/myfaces/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/unit-testing/create-test-junit-runner.html (added)
+++ websites/staging/myfaces/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/unit-testing/create-test-junit-runner.html Tue Mar  4 05:29:53 2014
@@ -0,0 +1,407 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE- 2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+  <head>
+    <title>Create Test using JUnit Runner</title>
+    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
+    
+    <link rel="stylesheet" type="text/css" media="all" href="/wiki/css/maven-base.css"/>
+    <link rel="stylesheet" type="text/css" media="all" href="/wiki/css/maven-theme.css"/>
+    <link rel="stylesheet" type="text/css" media="all" href="/wiki/css/codehilite.css"/>
+    <link rel="stylesheet" type="text/css" media="print" href="/wiki/css/print.css"/>
+    
+    
+
+    
+    <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file to you under the Apache License, Version 2.0 (the &quot;License&quot;); you may not use this file except in compliance with the License.  You may obtain a copy of the License at . http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the specific language governing permissions and limitations under the License. -->
+  </head>
+  <body>
+  <div id="header">
+    <div id="top_menu">
+      <div id="top_menu_container">
+          <!-- #simplePublishDate($decoration.publishDate)
+          #links( $decoration.body.links ) -->
+          <div class="date">
+            Last Published: <script>document.write(document.lastModified);</script>
+          </div>
+          <ul>
+<li><a href="http://www.apache.org/">Apache</a></li>
+<li><a href="http://myfaces.apache.org/index.html">MyFaces</a></li>
+<li><a href="/wiki/core/user-guide/quick-start.html">Quick Start</a></li>
+<li><a href="/wiki/core/user-guide.html">User Guide</a></li>
+<li><a href="/wiki/core/faq.html">FAQ</a></li>
+<li><a href="http://myfaces.apache.org/core22/javadoc.html">Generated Doc</a></li>
+<li><a href="http://myfaces.apache.org/download.html">Download</a></li>
+</ul>
+        <div class="clear"></div>
+      </div> <!-- close top_menu_container -->
+    </div> <!-- close top_menu -->
+    <div id="header_bottom">
+    <div id="logo_banner_container">
+      <!--#banner( $decoration.bannerLeft "logo" )-->
+      <div id="logo">
+        <a href="index.html">
+          <img src="/wiki/img/banners/MyFaces_logo.jpg" alt="" />
+        </a>
+      </div>
+      <!--#banner( $decoration.bannerRight "banner" )-->
+      <div id="banner">
+        <a href="http://www.apache.org/">
+          <img src="/wiki/img/banners/apache_banner.png" alt="" />
+        </a>
+      </div>    
+      <div class="clear"></div>
+    </div> <!-- close logo_banner_container -->
+    </div> <!-- close header_bottom -->
+  </div> <!-- close header -->
+    <div id="main_container">
+    <div id="left_column">
+        <div class="left_menu_top">
+<div class="left_menu_bottom">
+    <h5>JSF Implementations</h5>
+    <div class="content">
+        <ul class="left_menu">
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/core22/index.html">Core JSF-2.2</a>
+            </li>
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/core21/index.html">Core JSF-2.1</a>
+            </li>
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/core20/index.html">Core JSF-2.0</a>
+            </li>
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/core12/index.html">Core JSF-1.2</a>
+            </li>
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/core11/index.html">Core JSF-1.1</a>
+            </li>
+        </ul>
+    </div>
+</div><!-- close left_menu_bottom -->
+</div>
+
+<!-- close left_menu_top -->
+
+<div class="left_menu_top">
+<div class="left_menu_bottom">
+    <h5>UI-Component Sets</h5>
+    <div class="content">
+        <ul class="left_menu">
+            <li class="none">
+                <a href="http://myfaces.apache.org/trinidad/index.html">Trinidad</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/tobago/index.html">Tobago</a>
+            </li>
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/tomahawk/index.html">Tomahawk</a>
+            </li>
+        </ul>
+    </div><!-- close content -->
+</div><!-- close left_menu_bottom -->
+</div>
+
+<!-- close left_menu_top -->
+
+<div class="left_menu_top">
+<div class="left_menu_bottom">
+    <h5>Add-ons and Extensions</h5>
+    <div class="content">
+        <ul class="left_menu">
+            <li class="none">
+                <a href="http://myfaces.apache.org/extensions/cdi/index.html">CODI</a>
+            </li>
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/orchestra/index.html">Orchestra</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/extensions/validator/index.html">ExtVal</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/portlet-bridge/index.html">Portlet Bridge</a>
+            </li>
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/test/index.html">Test</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/commons/index.html">Commons</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/extensions/scripting/index.html">Ext-Scripting</a>
+            </li>
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/sandbox/index.html">Sandbox</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/otherProjects.html">Others</a>
+            </li>
+        </ul>
+    </div><!-- close content -->
+</div><!-- close left_menu_bottom -->
+</div>
+
+<!-- close left_menu_top -->
+
+<div class="left_menu_top">
+<div class="left_menu_bottom">
+    <h5>Project Documentation</h5>
+    <div class="content">
+        <ul class="left_menu">
+            <li class="none">
+                <a href="http://myfaces.apache.org/docindex.html">Documentation Index</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/jsfintro.html">JSF Intro</a>
+            </li>
+            <li class="none">
+                <a href="/wiki/core/user-guide/quick-start.html" class="externalLink">Quick Start<span/></a>
+            </li>
+            <li class="none">
+                <a href="/wiki/core/user-guide/getting-started.html" class="externalLink">Getting Started<span/></a>
+            </li>
+            <li class="none">
+                <a href="/wiki/core/faq.html" class="externalLink">FAQ<span/></a>
+            </li>
+            <li class="none">
+                <a href="https://cwiki.apache.org/confluence/display/MYFACES/Index" class="externalLink">Confluence Wiki<span/></a>
+            </li>
+            <li class="none">
+                <a href="http://wiki.apache.org/myfaces" class="externalLink">Public Wiki<span/></a>
+            </li>
+            <li class="none">
+                <a href="http://wiki.apache.org/myfaces/CompatibilityMatrix" class="externalLink">Compatibility<span/></a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/integration.html">Continuous Integration</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/issues.html">Issue Tracking</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/mail-lists.html">Mailing Lists</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/license.html">Project License</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/project-summary.html">Project Summary</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/team-list.html">Project Team</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/source-repository.html">Source Repository</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/index.html" class="selected">About</a>
+            </li>
+        </ul>
+    </div><!-- close content -->
+</div><!-- close left_menu_bottom -->
+</div>
+
+<!-- close left_menu_top -->
+
+<div class="left_menu_top">
+<div class="left_menu_bottom">
+    <h5>Foundation</h5>
+    <div class="content">
+        <ul class="left_menu">
+            <li class="none">
+                <a href="http://www.apache.org/" class="externalLink">ASF<span/></a>
+            </li>
+            <li class="none">
+                <a href="http://www.apache.org/foundation/sponsorship.html" class="externalLink">Sponsorship<span/></a>
+            </li>
+            <li class="none">
+                <a href="http://www.apache.org/foundation/thanks.html" class="externalLink">Thanks<span/></a>
+            </li>
+            <li class="none">
+                <a href="http://www.apache.org/security/" class="externalLink">Security<span/></a>
+            </li>
+            <li class="none">
+                <a href="http://www.apache.org/licenses/" class="externalLink">License<span/></a>
+            </li>
+        </ul>
+    </div><!-- close content -->
+</div><!-- close left_menu_bottom -->
+</div>
+
+<!-- close left_menu_top -->
+    <!--
+       #mainMenu( $decoration.body.menus )
+       #poweredByLogo( $decoration.poweredBy )
+       -->
+        <div id="powered_by">
+          <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
+            <img alt="Built by Maven" src="/wiki/img/banners/maven-feather.png"></img>
+          </a>
+        </div>
+    </div>
+    <div id="body_column">
+      <div>
+      <p><a href="/">Home</a>&nbsp;&raquo&nbsp;<a href="/wiki/">Wiki</a>&nbsp;&raquo&nbsp;<a href="/wiki/core.html">MyFaces Core</a>&nbsp;&raquo&nbsp;<a href="/wiki/core/user-guide.html">MyFaces Core User Guide</a>&nbsp;&raquo&nbsp;<a href="/wiki/core/user-guide/jsf-and-myfaces-howtos.html">JSF and MyFaces Howtos</a>&nbsp;&raquo&nbsp;<a href="/wiki/core/user-guide/jsf-and-myfaces-howtos/unit-testing.html">Unit Testing</a></p>
+      <h2>Create Test using JUnit Runner</h2>
+      <div id="content" class="grid_16"><div class="section-content"><p>Create Test using JUnit Runner is no different than write other JUnit tests.
+Just use MyFacesTestRunner to run the tests. </p>
+<div class="codehilite"><pre><span class="nd">@RunWith</span><span class="o">(</span><span class="n">MyFacesTestRunner</span><span class="o">.</span><span class="na">class</span><span class="o">)</span>
+<span class="nd">@TestConfig</span><span class="o">(</span><span class="n">webappResourcePath</span> <span class="o">=</span> <span class="s">&quot;webapp&quot;</span><span class="o">)</span>
+<span class="kd">public</span> <span class="kd">class</span> <span class="nc">DemoTestCase</span>
+<span class="o">{</span>
+    <span class="nd">@TestContainer</span>
+    <span class="kd">private</span> <span class="n">MyFacesContainer</span> <span class="n">container</span><span class="o">;</span>
+
+    <span class="nd">@Test</span>
+    <span class="kd">public</span> <span class="kt">void</span> <span class="nf">testHelloWorld</span><span class="o">()</span> <span class="kd">throws</span> <span class="n">Exception</span>
+    <span class="o">{</span>
+        <span class="n">container</span><span class="o">.</span><span class="na">startViewRequest</span><span class="o">(</span><span class="s">&quot;/helloWorld.xhtml&quot;</span><span class="o">);</span>
+        <span class="n">container</span><span class="o">.</span><span class="na">processLifecycleExecute</span><span class="o">();</span>
+        <span class="n">container</span><span class="o">.</span><span class="na">renderResponse</span><span class="o">();</span>
+
+        <span class="n">container</span><span class="o">.</span><span class="na">getClient</span><span class="o">().</span><span class="na">inputText</span><span class="o">(</span><span class="s">&quot;mainForm:name&quot;</span><span class="o">,</span> <span class="s">&quot;John Smith&quot;</span><span class="o">);</span>
+        <span class="c1">// The button end current request and start a new request </span>
+        <span class="c1">// with a simulated submit </span>
+        <span class="n">container</span><span class="o">.</span><span class="na">getClient</span><span class="o">().</span><span class="na">submit</span><span class="o">(</span><span class="s">&quot;mainForm:submit&quot;</span><span class="o">);</span>
+
+        <span class="n">container</span><span class="o">.</span><span class="na">processLifecycleExecute</span><span class="o">();</span>
+
+        <span class="n">Assert</span><span class="o">.</span><span class="na">assertEquals</span><span class="o">(</span><span class="s">&quot;/page2.xhtml&quot;</span><span class="o">,</span> 
+            <span class="n">container</span><span class="o">.</span><span class="na">getFacesContext</span><span class="o">().</span><span class="na">getViewRoot</span><span class="o">().</span><span class="na">getViewId</span><span class="o">());</span>
+        <span class="n">container</span><span class="o">.</span><span class="na">renderResponse</span><span class="o">();</span>
+        <span class="n">container</span><span class="o">.</span><span class="na">endRequest</span><span class="o">();</span>
+    <span class="o">}</span>
+<span class="o">}</span>
+</pre></div>
+
+
+<p>The key object to control the lifecycle and the context in general is 
+MyFacesContainer. With this object, it is possible to send a request, 
+execute the lifecycle, make assertions and so on. Remember you are always 
+on the server side, and the "client" is just something in the middle that 
+mimic the steps done by the browser, so it is quite simple to write 
+a custom client that manipulates MyFacesContainer for a third party library.</p>
+<p>There are some annotations that allow to define methods that are called at some
+specified points:</p>
+<ul>
+<li>@BeforeRequest and @AfterRequest</li>
+<li>@SetupWebConfigParams : makes the method called before init but after 
+   servletContext is created</li>
+<li>@BeforeJSFInit : called after servlet listeners are initialized but before
+   JSF init.</li>
+</ul>
+<p>Here are some examples about how to make it run with different environments:</p>
+<h3 id="apache-myfaces-core-apache-openwebbeans">Apache MyFaces Core + Apache OpenWebbeans</h3>
+<div class="codehilite"><pre><span class="nd">@RunWith</span><span class="o">(</span><span class="n">MyFacesTestRunner</span><span class="o">.</span><span class="na">class</span><span class="o">)</span>
+<span class="nd">@TestConfig</span><span class="o">(</span>
+    <span class="n">scanAnnotations</span> <span class="o">=</span> <span class="kc">false</span><span class="o">,</span>
+    <span class="n">webappResourcePath</span> <span class="o">=</span> <span class="s">&quot;webapp&quot;</span><span class="o">,</span>
+    <span class="n">expressionFactory</span> <span class="o">=</span> <span class="s">&quot;com.sun.el.ExpressionFactoryImpl&quot;</span><span class="o">)</span>
+<span class="nd">@TestServletListeners</span><span class="o">({</span>
+    <span class="s">&quot;org.apache.webbeans.servlet.WebBeansConfigurationListener&quot;</span>
+<span class="o">})</span>
+<span class="kd">public</span> <span class="kd">class</span> <span class="nc">MyFacesRunnerSimpleTestCase</span>
+<span class="o">{</span>
+    <span class="nd">@TestContainer</span>
+    <span class="kd">private</span> <span class="n">MyFacesContainer</span> <span class="n">container</span><span class="o">;</span>
+
+    <span class="nd">@Inject</span>
+    <span class="nd">@Named</span><span class="o">(</span><span class="s">&quot;helloWorld&quot;</span><span class="o">)</span>
+    <span class="kd">private</span> <span class="n">HelloWorldController</span> <span class="n">helloWorldBean</span><span class="o">;</span>
+
+    <span class="nd">@Test</span>
+    <span class="kd">public</span> <span class="kt">void</span> <span class="nf">testHelloWorld</span><span class="o">()</span> <span class="kd">throws</span> <span class="n">Exception</span>
+    <span class="o">{</span>
+        <span class="c1">// ....</span>
+</pre></div>
+
+
+<h3 id="apache-myfaces-core-spring-3">Apache MyFaces Core + Spring 3</h3>
+<p>Please note bean injection is only supported for CDI, but it is possible
+to enable it if you provide an implementation of InjectionProvider spi 
+interface:</p>
+<div class="codehilite"><pre><span class="nd">@RunWith</span><span class="o">(</span><span class="n">MyFacesTestRunner</span><span class="o">.</span><span class="na">class</span><span class="o">)</span>
+<span class="nd">@TestConfig</span><span class="o">(</span>
+    <span class="n">scanAnnotations</span> <span class="o">=</span> <span class="kc">true</span><span class="o">,</span>
+    <span class="n">oamAnnotationScanPackages</span> <span class="o">=</span> <span class="s">&quot;jsf2jpa&quot;</span><span class="o">,</span>
+    <span class="n">webappResourcePath</span> <span class="o">=</span> <span class="s">&quot;webapp&quot;</span><span class="o">,</span>
+    <span class="n">expressionFactory</span> <span class="o">=</span> <span class="s">&quot;com.sun.el.ExpressionFactoryImpl&quot;</span><span class="o">)</span>
+<span class="nd">@TestServletListeners</span><span class="o">({</span>
+    <span class="s">&quot;org.springframework.web.context.ContextLoaderListener&quot;</span><span class="o">,</span>
+    <span class="s">&quot;org.springframework.web.context.request.RequestContextListener&quot;</span>
+<span class="o">})</span>
+<span class="kd">public</span> <span class="kd">class</span> <span class="nc">MyFacesRunnerSimpleTestCase</span>
+<span class="o">{</span>
+    <span class="nd">@TestContainer</span>
+    <span class="kd">private</span> <span class="n">MyFacesContainer</span> <span class="n">container</span><span class="o">;</span>
+
+    <span class="nd">@Test</span>
+    <span class="kd">public</span> <span class="kt">void</span> <span class="nf">testHelloWorld</span><span class="o">()</span> <span class="kd">throws</span> <span class="n">Exception</span>
+    <span class="o">{</span>
+        <span class="c1">// ....</span>
+</pre></div>
+
+
+<h3 id="apache-myfaces-core-weld-11x">Apache MyFaces Core + Weld 1.1.x</h3>
+<div class="codehilite"><pre><span class="nd">@RunWith</span><span class="o">(</span><span class="n">MyFacesTestRunner</span><span class="o">.</span><span class="na">class</span><span class="o">)</span>
+<span class="nd">@TestConfig</span><span class="o">(</span>
+    <span class="n">scanAnnotations</span> <span class="o">=</span> <span class="kc">false</span><span class="o">,</span>
+    <span class="n">webappResourcePath</span> <span class="o">=</span> <span class="s">&quot;webapp&quot;</span><span class="o">,</span>
+    <span class="n">expressionFactory</span> <span class="o">=</span> <span class="s">&quot;com.sun.el.ExpressionFactoryImpl&quot;</span><span class="o">)</span>
+<span class="nd">@TestServletListeners</span><span class="o">({</span>
+    <span class="s">&quot;org.jboss.weld.environment.servlet.Listener&quot;</span>
+<span class="o">})</span>
+<span class="kd">public</span> <span class="kd">class</span> <span class="nc">MyFacesRunnerSimpleTestCase</span>
+<span class="o">{</span>
+    <span class="nd">@TestContainer</span>
+    <span class="kd">private</span> <span class="n">MyFacesContainer</span> <span class="n">container</span><span class="o">;</span>
+
+    <span class="nd">@Inject</span>
+    <span class="nd">@Named</span><span class="o">(</span><span class="s">&quot;helloWorld&quot;</span><span class="o">)</span>
+    <span class="kd">private</span> <span class="n">HelloWorldController</span> <span class="n">helloWorldBean</span><span class="o">;</span>
+
+    <span class="nd">@BeforeJSFInit</span>
+    <span class="kd">public</span> <span class="kt">void</span> <span class="nf">init</span><span class="o">()</span> <span class="kd">throws</span> <span class="n">NamingException</span>
+    <span class="o">{</span>
+        <span class="n">InitialContext</span> <span class="n">ic</span> <span class="o">=</span> <span class="k">new</span> <span class="n">InitialContext</span><span class="o">();</span>
+        <span class="n">ic</span><span class="o">.</span><span class="na">bind</span><span class="o">(</span><span class="s">&quot;java:comp/env/BeanManager&quot;</span><span class="o">,</span> 
+            <span class="n">container</span><span class="o">.</span><span class="na">getServletContext</span><span class="o">().</span><span class="na">getAttribute</span><span class="o">(</span>
+                <span class="s">&quot;org.jboss.weld.environment.servlet.javax.enterprise.inject.spi.BeanManager&quot;</span><span class="o">));</span>
+        <span class="n">container</span><span class="o">.</span><span class="na">getServletContext</span><span class="o">().</span><span class="na">setAttribute</span><span class="o">(</span><span class="s">&quot;javax.enterprise.inject.spi.BeanManager&quot;</span><span class="o">,</span>
+            <span class="n">container</span><span class="o">.</span><span class="na">getServletContext</span><span class="o">().</span><span class="na">getAttribute</span><span class="o">(</span>
+                <span class="s">&quot;org.jboss.weld.environment.servlet.javax.enterprise.inject.spi.BeanManager&quot;</span><span class="o">));</span>
+    <span class="o">}</span>
+
+    <span class="nd">@Test</span>
+    <span class="kd">public</span> <span class="kt">void</span> <span class="nf">testHelloWorld</span><span class="o">()</span> <span class="kd">throws</span> <span class="n">Exception</span>
+    <span class="o">{</span>
+        <span class="c1">// ....</span>
+</pre></div></div></div>
+      </div>
+    </div>
+    <div class="clear"></div>
+    </div> <!-- close main container -->
+    <div id="footer">
+      <div class="copyright">
+      Copyright &#169; Apache Software Foundation, Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.<br/>
+       Apache MyFaces, Apache Tobago, Apache, the Apache feather logo, and the Apache MyFaces project logos are trademarks of The Apache Software Foundation.
+      </div><!-- close copyright -->
+    </div><!-- close footer -->
+  </body>
+</html>

Added: websites/staging/myfaces/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/unit-testing/setup-with-maven.html
==============================================================================
--- websites/staging/myfaces/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/unit-testing/setup-with-maven.html (added)
+++ websites/staging/myfaces/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/unit-testing/setup-with-maven.html Tue Mar  4 05:29:53 2014
@@ -0,0 +1,350 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE- 2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+  <head>
+    <title>Setup Test Environment with Maven</title>
+    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
+    
+    <link rel="stylesheet" type="text/css" media="all" href="/wiki/css/maven-base.css"/>
+    <link rel="stylesheet" type="text/css" media="all" href="/wiki/css/maven-theme.css"/>
+    <link rel="stylesheet" type="text/css" media="all" href="/wiki/css/codehilite.css"/>
+    <link rel="stylesheet" type="text/css" media="print" href="/wiki/css/print.css"/>
+    
+    
+
+    
+    <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file to you under the Apache License, Version 2.0 (the &quot;License&quot;); you may not use this file except in compliance with the License.  You may obtain a copy of the License at . http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the specific language governing permissions and limitations under the License. -->
+  </head>
+  <body>
+  <div id="header">
+    <div id="top_menu">
+      <div id="top_menu_container">
+          <!-- #simplePublishDate($decoration.publishDate)
+          #links( $decoration.body.links ) -->
+          <div class="date">
+            Last Published: <script>document.write(document.lastModified);</script>
+          </div>
+          <ul>
+<li><a href="http://www.apache.org/">Apache</a></li>
+<li><a href="http://myfaces.apache.org/index.html">MyFaces</a></li>
+<li><a href="/wiki/core/user-guide/quick-start.html">Quick Start</a></li>
+<li><a href="/wiki/core/user-guide.html">User Guide</a></li>
+<li><a href="/wiki/core/faq.html">FAQ</a></li>
+<li><a href="http://myfaces.apache.org/core22/javadoc.html">Generated Doc</a></li>
+<li><a href="http://myfaces.apache.org/download.html">Download</a></li>
+</ul>
+        <div class="clear"></div>
+      </div> <!-- close top_menu_container -->
+    </div> <!-- close top_menu -->
+    <div id="header_bottom">
+    <div id="logo_banner_container">
+      <!--#banner( $decoration.bannerLeft "logo" )-->
+      <div id="logo">
+        <a href="index.html">
+          <img src="/wiki/img/banners/MyFaces_logo.jpg" alt="" />
+        </a>
+      </div>
+      <!--#banner( $decoration.bannerRight "banner" )-->
+      <div id="banner">
+        <a href="http://www.apache.org/">
+          <img src="/wiki/img/banners/apache_banner.png" alt="" />
+        </a>
+      </div>    
+      <div class="clear"></div>
+    </div> <!-- close logo_banner_container -->
+    </div> <!-- close header_bottom -->
+  </div> <!-- close header -->
+    <div id="main_container">
+    <div id="left_column">
+        <div class="left_menu_top">
+<div class="left_menu_bottom">
+    <h5>JSF Implementations</h5>
+    <div class="content">
+        <ul class="left_menu">
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/core22/index.html">Core JSF-2.2</a>
+            </li>
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/core21/index.html">Core JSF-2.1</a>
+            </li>
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/core20/index.html">Core JSF-2.0</a>
+            </li>
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/core12/index.html">Core JSF-1.2</a>
+            </li>
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/core11/index.html">Core JSF-1.1</a>
+            </li>
+        </ul>
+    </div>
+</div><!-- close left_menu_bottom -->
+</div>
+
+<!-- close left_menu_top -->
+
+<div class="left_menu_top">
+<div class="left_menu_bottom">
+    <h5>UI-Component Sets</h5>
+    <div class="content">
+        <ul class="left_menu">
+            <li class="none">
+                <a href="http://myfaces.apache.org/trinidad/index.html">Trinidad</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/tobago/index.html">Tobago</a>
+            </li>
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/tomahawk/index.html">Tomahawk</a>
+            </li>
+        </ul>
+    </div><!-- close content -->
+</div><!-- close left_menu_bottom -->
+</div>
+
+<!-- close left_menu_top -->
+
+<div class="left_menu_top">
+<div class="left_menu_bottom">
+    <h5>Add-ons and Extensions</h5>
+    <div class="content">
+        <ul class="left_menu">
+            <li class="none">
+                <a href="http://myfaces.apache.org/extensions/cdi/index.html">CODI</a>
+            </li>
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/orchestra/index.html">Orchestra</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/extensions/validator/index.html">ExtVal</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/portlet-bridge/index.html">Portlet Bridge</a>
+            </li>
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/test/index.html">Test</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/commons/index.html">Commons</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/extensions/scripting/index.html">Ext-Scripting</a>
+            </li>
+            <li class="collapsed">
+                <a href="http://myfaces.apache.org/sandbox/index.html">Sandbox</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/otherProjects.html">Others</a>
+            </li>
+        </ul>
+    </div><!-- close content -->
+</div><!-- close left_menu_bottom -->
+</div>
+
+<!-- close left_menu_top -->
+
+<div class="left_menu_top">
+<div class="left_menu_bottom">
+    <h5>Project Documentation</h5>
+    <div class="content">
+        <ul class="left_menu">
+            <li class="none">
+                <a href="http://myfaces.apache.org/docindex.html">Documentation Index</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/jsfintro.html">JSF Intro</a>
+            </li>
+            <li class="none">
+                <a href="/wiki/core/user-guide/quick-start.html" class="externalLink">Quick Start<span/></a>
+            </li>
+            <li class="none">
+                <a href="/wiki/core/user-guide/getting-started.html" class="externalLink">Getting Started<span/></a>
+            </li>
+            <li class="none">
+                <a href="/wiki/core/faq.html" class="externalLink">FAQ<span/></a>
+            </li>
+            <li class="none">
+                <a href="https://cwiki.apache.org/confluence/display/MYFACES/Index" class="externalLink">Confluence Wiki<span/></a>
+            </li>
+            <li class="none">
+                <a href="http://wiki.apache.org/myfaces" class="externalLink">Public Wiki<span/></a>
+            </li>
+            <li class="none">
+                <a href="http://wiki.apache.org/myfaces/CompatibilityMatrix" class="externalLink">Compatibility<span/></a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/integration.html">Continuous Integration</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/issues.html">Issue Tracking</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/mail-lists.html">Mailing Lists</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/license.html">Project License</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/project-summary.html">Project Summary</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/team-list.html">Project Team</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/source-repository.html">Source Repository</a>
+            </li>
+            <li class="none">
+                <a href="http://myfaces.apache.org/index.html" class="selected">About</a>
+            </li>
+        </ul>
+    </div><!-- close content -->
+</div><!-- close left_menu_bottom -->
+</div>
+
+<!-- close left_menu_top -->
+
+<div class="left_menu_top">
+<div class="left_menu_bottom">
+    <h5>Foundation</h5>
+    <div class="content">
+        <ul class="left_menu">
+            <li class="none">
+                <a href="http://www.apache.org/" class="externalLink">ASF<span/></a>
+            </li>
+            <li class="none">
+                <a href="http://www.apache.org/foundation/sponsorship.html" class="externalLink">Sponsorship<span/></a>
+            </li>
+            <li class="none">
+                <a href="http://www.apache.org/foundation/thanks.html" class="externalLink">Thanks<span/></a>
+            </li>
+            <li class="none">
+                <a href="http://www.apache.org/security/" class="externalLink">Security<span/></a>
+            </li>
+            <li class="none">
+                <a href="http://www.apache.org/licenses/" class="externalLink">License<span/></a>
+            </li>
+        </ul>
+    </div><!-- close content -->
+</div><!-- close left_menu_bottom -->
+</div>
+
+<!-- close left_menu_top -->
+    <!--
+       #mainMenu( $decoration.body.menus )
+       #poweredByLogo( $decoration.poweredBy )
+       -->
+        <div id="powered_by">
+          <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
+            <img alt="Built by Maven" src="/wiki/img/banners/maven-feather.png"></img>
+          </a>
+        </div>
+    </div>
+    <div id="body_column">
+      <div>
+      <p><a href="/">Home</a>&nbsp;&raquo&nbsp;<a href="/wiki/">Wiki</a>&nbsp;&raquo&nbsp;<a href="/wiki/core.html">MyFaces Core</a>&nbsp;&raquo&nbsp;<a href="/wiki/core/user-guide.html">MyFaces Core User Guide</a>&nbsp;&raquo&nbsp;<a href="/wiki/core/user-guide/jsf-and-myfaces-howtos.html">JSF and MyFaces Howtos</a>&nbsp;&raquo&nbsp;<a href="/wiki/core/user-guide/jsf-and-myfaces-howtos/unit-testing.html">Unit Testing</a></p>
+      <h2>Setup Test Environment with Maven</h2>
+      <div id="content" class="grid_16"><div class="section-content"><p>First of all, you need to include the required test dependencies into your
+project:</p>
+<div class="codehilite"><pre><span class="c">&lt;!-- MyFaces 2.2.x should be available as a compile dependency or</span>
+<span class="c">     as a test dependency --&gt;</span>
+<span class="c">&lt;!-- Base library to run MyFaces in a JUnit test. If you are</span>
+<span class="c">     using MyFaces Core 2.2.1 use the same version number --&gt;</span>
+<span class="nt">&lt;dependency&gt;</span>
+    <span class="nt">&lt;groupId&gt;</span>org.apache.myfaces.core<span class="nt">&lt;/groupId&gt;</span>
+    <span class="nt">&lt;artifactId&gt;</span>myfaces-impl-test<span class="nt">&lt;/artifactId&gt;</span>
+    <span class="nt">&lt;version&gt;</span>2.2.1<span class="nt">&lt;/version&gt;</span>
+    <span class="nt">&lt;scope&gt;</span>test<span class="nt">&lt;/scope&gt;</span>
+<span class="nt">&lt;/dependency&gt;</span>
+
+<span class="c">&lt;!-- The library uses Myfaces-Test mock objects --&gt;</span>
+<span class="nt">&lt;dependency&gt;</span>
+    <span class="nt">&lt;groupId&gt;</span>org.apache.myfaces.test<span class="nt">&lt;/groupId&gt;</span>
+    <span class="nt">&lt;artifactId&gt;</span>myfaces-test22<span class="nt">&lt;/artifactId&gt;</span>
+    <span class="nt">&lt;version&gt;</span>1.0.6<span class="nt">&lt;/version&gt;</span>
+    <span class="nt">&lt;scope&gt;</span>test<span class="nt">&lt;/scope&gt;</span>
+<span class="nt">&lt;/dependency&gt;</span>
+
+<span class="c">&lt;!-- Don&#39;t forget junit --&gt;</span>
+<span class="nt">&lt;dependency&gt;</span>
+    <span class="nt">&lt;groupId&gt;</span>junit<span class="nt">&lt;/groupId&gt;</span>
+    <span class="nt">&lt;artifactId&gt;</span>junit<span class="nt">&lt;/artifactId&gt;</span>
+    <span class="nt">&lt;version&gt;</span>4.11<span class="nt">&lt;/version&gt;</span>
+<span class="nt">&lt;/dependency&gt;</span>
+
+<span class="c">&lt;!-- Don&#39;t forget to include an EL implementation, otherwise</span>
+<span class="c">     you will use the mock EL implementation bundled with</span>
+<span class="c">     MyFaces Test --&gt;</span>
+<span class="nt">&lt;dependency&gt;</span>
+    <span class="nt">&lt;groupId&gt;</span>org.eclipse.jetty.orbit<span class="nt">&lt;/groupId&gt;</span>
+    <span class="nt">&lt;artifactId&gt;</span>javax.el<span class="nt">&lt;/artifactId&gt;</span>
+    <span class="nt">&lt;version&gt;</span>2.2.0.v201108011116<span class="nt">&lt;/version&gt;</span>
+    <span class="nt">&lt;scope&gt;</span>test<span class="nt">&lt;/scope&gt;</span>
+<span class="nt">&lt;/dependency&gt;</span>
+<span class="nt">&lt;dependency&gt;</span>
+    <span class="nt">&lt;groupId&gt;</span>org.eclipse.jetty.orbit<span class="nt">&lt;/groupId&gt;</span>
+    <span class="nt">&lt;artifactId&gt;</span>com.sun.el<span class="nt">&lt;/artifactId&gt;</span>
+    <span class="nt">&lt;version&gt;</span>2.2.0.v201108011116<span class="nt">&lt;/version&gt;</span>
+    <span class="nt">&lt;scope&gt;</span>test<span class="nt">&lt;/scope&gt;</span>
+<span class="nt">&lt;/dependency&gt;</span>
+</pre></div>
+
+
+<p>Suppose a typical web application using maven. It usually has the following
+structure:</p>
+<div class="codehilite"><pre>src
+ |- main
+      |- java
+      |- resources
+      |- webapp
+ |- test
+      |- java
+      |- resources
+</pre></div>
+
+
+<p>In the test phase, by default the environment only has access to the resources
+in src/main/java, src/main/resources, src/test/java and src/test/resources
+through the classpath. So one thing you need is make the webapp folder accesible
+as test resources through the classpath with something like this.</p>
+<div class="codehilite"><pre><span class="nt">&lt;build&gt;</span>
+    <span class="nt">&lt;testResources&gt;</span>
+        <span class="nt">&lt;testResource&gt;</span>
+            <span class="nt">&lt;directory&gt;</span>${project.basedir}/src/test/resources<span class="nt">&lt;/directory&gt;</span>
+        <span class="nt">&lt;/testResource&gt;</span>
+        <span class="nt">&lt;testResource&gt;</span>
+            <span class="nt">&lt;directory&gt;</span>${project.basedir}/src/main/webapp<span class="nt">&lt;/directory&gt;</span>
+            <span class="nt">&lt;targetPath&gt;</span>webapp<span class="nt">&lt;/targetPath&gt;</span>
+        <span class="nt">&lt;/testResource&gt;</span>
+    <span class="nt">&lt;/testResources&gt;</span>
+
+    <span class="c">&lt;!-- ... --&gt;</span>
+<span class="nt">&lt;/build&gt;</span>
+</pre></div></div></div>
+      </div>
+    </div>
+    <div class="clear"></div>
+    </div> <!-- close main container -->
+    <div id="footer">
+      <div class="copyright">
+      Copyright &#169; Apache Software Foundation, Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.<br/>
+       Apache MyFaces, Apache Tobago, Apache, the Apache feather logo, and the Apache MyFaces project logos are trademarks of The Apache Software Foundation.
+      </div><!-- close copyright -->
+    </div><!-- close footer -->
+  </body>
+</html>