Log in to follow, share, and participate in this community.
Article UsingComponentIDs
UsingComponentIDsAssigning Component ID's The first thing to know about writing a JSFUnit test is that you should get into the habit of assigning component ID's to your components on a JSF page. For every JSF component (except &...
Using JSFUnit with Servlet 3.0JSFUnit 1.2 takes advantage of new features in Servlet 3.0 to make setting up and running JSFUnit tests faster and easier. To take advantage of these features: Use a Servlet 3.0 container Use the Servlet 2.5 o...
JSFUnitWithRichFacesIntroduction RichFaces/Ajax4jsf is the first Ajax component library to be supported by JSFUnit. Our plan is to make sure that all of the popular JSF libraries work well with JSFUnit. RichFaces and JSFUnit Since ...
GettingStartedGuideGetting Started Guide There is a "Getting Started Guide" on the JSFUnit web site. Click Here The hardest part about using JSFUnit is preparing your WAR. You have to add several jar files, plus you need t...
RunningJSFUnitRunning JSFUnit TestsFirst Prepare your WAR If you are not using JBoss AS 5, you will need to prepare your WAR file when you build it using the Ant instructions or Maven instructions. If you are using JBoss AS 5...
JSFUnitTestingSecurePagesTesting Secure Pages Most applications have at least some pages that require authenticated access. So you will need your test to log in to the application before you start testing the secure page. J...
Using JSFUnit with EclipseRunning JSFUnit tests inside Eclipse is actually quite simple! The following instructions assume the following: You can run JUnit tests within eclipse already You have successfully run a JSFUnit test on you...
JSFUnitWithAntThe jsfunitwar Ant task JSFUnit provides an Ant task that takes your WAR and "jsfunifies" it. That is, it adds filters and servlets to the web.xml and it adds jars to WEB-INF/lib. Here are the attributes f...
JSFUnitWithASMicrocontainerJBoss AS 5 Microcontainer Deployer For JBoss AS 5, you can use the JSFUnit deployer. This allows you to add JSFUnit testing without a single change to any part of your WAR. This makes using JSFUnit far easier be...
Article Use JSFUnit for testing of multipart/form-data file inputs
Use JSFUnit for testing of multipart/form-data file inputsTomahawk provides an t:inputFileUpload tag for uploading of files using <input type="file"/> element and multipart/form-data HTML form. Apparently I didn't found how to provide the value for the input element us...
WorkingWithStubsThe stub library is a port of the Shale Test Framework. The only major difference is that the word "mock" has been replaced with "stub", see Mocks Aren't Stubs for why this decision was made. The ...
JSFUnitSessionAndThreadsThe HttpSession JSFUnit tests use the HttpSession as a conduit for the FacesContext. Here is what happens behind the scenes during a JSFUnit test: JUnit calls Cactus to run your test from the container. The J...
AjaxWithJSFUnitJSFUnit should work perfectly fine with AJAX-enabled applications. This is because we rely on HTMLUnit to act as a "headless browser". So anytime a browser event (like onchange or onclick) is fired, the co...
Using the HtmlUnit API with JSFUnitJSFUnit uses HtmlUnit as a headless browser to fill in forms, submit requests, and execute javascript. For most client tasks, you can use the JSFClientSessionAPI object and let HtmlUnit run "under the covers"....
JSFServerSessionAPIThe JSFServerSession Class JSFUnit's JSFServerSession provides access to server-side objects needed to examine the entire state of a JSF application. To see the full javadoc for this class, click here. ...
Article Using "select" components (Listbox, Radio, Menu, etc)
Using "select" components (Listbox, Radio, Menu, etc)"Select" components such as <h:selectOneMenu> or <h:selectManyListbox> allow you to select one or more items in a component. The JSF components <f:selectItem> and <f:selectItems> allow yo...
JSFClientSessionAPIThe JSFClientSession class JSFUnit's JSFClientSession class is used to impersonate a browser and its user input during a test. To see the full javadoc for this class, click here. Getting a JSFClientSe...
JSFSessionAPIUsing the JSFSession API The JSFSession is the starting point for most JSFUnit tests. The javadoc for JSFSession is here You create the JSFSession object by passing a partial JSF URL into the cons...
JSFUnitOnWebSphereWorkaround needed for WebSphere users WebSphere prepends a cache ID to the jsessionid. The cache ID is used for session affinity and it is enabled by default. As of now, it is unknown how this behavior can...
JSFUnit FAQDoes JSFUnit work with RichFaces? Yes. See JSFUnitWithRichFaces Does JSFUnit work with Tomahawk? Yes. We don't have any tests for Tomahawk in the JSFUnit test suite, but developers in the community ...