This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Hands On Software Engineering with Python and have Brian Allbey on-line!
See this thread for details.
Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Unit Testability ---JSF  RSS feed

 
Ranch Hand
Posts: 178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In JSF can Components be tested independently as pure java objects?



Thanks
 
Author
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can test JSF components, but you'd have to mock a fair bit of the JSF implementation. The JSF Reference Implementation does that for internal testing.
 
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by David Geary:
but you'd have to mock a fair bit of the JSF implementation. The JSF Reference Implementation does that for internal testing.



David just one question: Has the RI released it as a public api, i mean the mocks that they use internally?
thanks
 
David Geary
Author
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The API for the mocks is not part of the spec. But the JSF 1.1_01 reference implementation is open source, so I believe you can get the source to the mocks if you want.
 
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just curious, why would you want to Unit Test JSF UIComponents?
 
David Geary
Author
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You want to unit test components for the same reason you unit test model beans: to make sure they're implemented according to their implicit design decisions and to make sure you don't inadvertently violate those decisions in the future.
 
author
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's what I use to unit-test my managed beans:

BasePageTestCase:

https://appfuse.dev.java.net/nonav/source/browse/*checkout*/appfuse/extras/jsf/test/web/org/appfuse/webapp/action/BasePageTestCase.java?rev=HEAD

Simple testing of a bean - notice the getManagedBean() call in the setUp() method:

https://appfuse.dev.java.net/nonav/source/browse/*checkout*/appfuse/extras/jsf/test/web/org/appfuse/webapp/action/PasswordHintTest.java?rev=HEAD&content-type=text/plain
 
Yeast devil! Back to the oven that baked you! And take this tiny ad too:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!