Version 2

    An Arquillian JSFUnit Test Class is an ordinary JUnit 4 class using Arquillian's @RunWith and @Deployment annotations.  It also uses JSFUnit Annotations to configure and inject JSFSession, JSFClientSession, and JSFServerSession objects.

     

    Here is a simple example:

     

    @RunWith(Arquillian.class)
    public class MyTest {
    
        @Deployment
        public static WebArchive createDeployment() {
              WebArchive war = ShrinkWrap
                    .create(WebArchive.class)
                    .addPackage(Package.getPackage("org.jboss.jsfunit.example.hellojsf"))
                    .addAsWebInfResource(new File("src/main/webapp/WEB-INF/faces-config.xml"), "faces-config.xml"));
              war.setWebXML(new StringAsset(createWebXML().exportAsString()));
              return war;
        }
    
        @Test
        @InitialPage("/index.faces")
        public void testGetCurrentViewId(JSFServerSession server) throws IOException {
            // Test navigation to initial viewID
            assertViewId("/index", server.getCurrentViewID());
            Assert.assertEquals(server.getCurrentViewID(), server.getFacesContext().getViewRoot().getViewId());
        }
    }