[email_address]
Agenda <ul><li>Api Description </li></ul><ul><li>Features </li></ul><ul><li>Unitils Design </li></ul><ul><li>Supported Mod...
 
Unitils test Tool <ul><li>Unitils is an open source library aimed at making unit testing easy and maintainable. Unitils bu...
Currently Unitils offers following  features  <ul><li>Assertion utils </li></ul><ul><ul><li>Equality assertion through ref...
Currently Unitils offers following features <ul><li>Mock object utilities   </li></ul><ul><ul><li>Simplify EasyMock mock o...
 
Open & extensible architecture <ul><li>Module system </li></ul><ul><ul><li>Listener hooks up modules into tests </li></ul>...
Module Systems <ul><li>Database Module </li></ul><ul><li>DBUnit module </li></ul><ul><ul><li>Test data management </li></u...
Database testing <ul><li>Control over test data </li></ul><ul><ul><li>Unit test database without data </li></ul></ul><ul><...
Class-level data file
Method-level data file
Specify file name explicitly
Result data file
Hibernate support <ul><li>Simplify configuration </li></ul><ul><li>Automatically check consistency of </li></ul><ul><ul><l...
Assertion utils
Maintainability <ul><li>Only check what’s essential </li></ul><ul><ul><li>Ignore type of numbers </li></ul></ul><ul><ul><l...
Ignore order and type of Collections <ul><li>Leniency option: collections </li></ul>
Unitils Configuration <ul><li>As with many projects, Unitils needs some configuration of its services. By default, there a...
 
Programme a tester <ul><li>Employees : DTO Object </li></ul><ul><li>IEmployeeDao : interface that declare CRUD opperations...
Programme de test <ul><li>HibernateMappingTest </li></ul><ul><li>EmployeeDaoTest : </li></ul><ul><li>EmployeeDao Testing C...
Configuration Unitils « unitils.properties »
HibernateMappingTest <ul><li>@SpringApplicationContext  annotation instructs Unitils to create a Spring ApplicationContext...
HibernateMappingTest  «   propety title of class Employees result goes titleD » <ul><li>junit.framework.AssertionFailedErr...
EmployeeDaoTest <ul><li>Creating an application context and retrieving a Spring bean  </li></ul><ul><li>we tell the system...
Links <ul><li>Unitils website: </li></ul><ul><li>http://unitils.sourceforge.net </li></ul><ul><li>Unit testing guidelines:...
Upcoming SlideShare
Loading in...5
×

Unitils

1,847

Published on

Unitils Testing FrameWork presentation

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,847
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
39
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Unitils

  1. 1. [email_address]
  2. 2. Agenda <ul><li>Api Description </li></ul><ul><li>Features </li></ul><ul><li>Unitils Design </li></ul><ul><li>Supported Module System </li></ul><ul><li>Unitils by Example </li></ul>
  3. 4. Unitils test Tool <ul><li>Unitils is an open source library aimed at making unit testing easy and maintainable. Unitils builds further on existing libraries like DBUnit and EasyMock and integrates with JUnit and TestNG . </li></ul><ul><li>Unitils provides general asserion utilities, support for database testing, support for testing with mock objects and offers integration with Spring and Hibernate . It has been designed to offer these services to unit tests in a very configurable and loosely coupled way. As a result, services can be added and extended very easily. </li></ul>
  4. 5. Currently Unitils offers following features <ul><li>Assertion utils </li></ul><ul><ul><li>Equality assertion through reflection, with different options like ignoring Java default/null values and ignoring order of collections </li></ul></ul><ul><li>Database testing utilities : </li></ul><ul><ul><li>Test data management </li></ul></ul><ul><ul><li>DBUnit </li></ul></ul><ul><ul><li>Test database maintenance </li></ul></ul><ul><ul><li>Testing with Hibernate </li></ul></ul>
  5. 6. Currently Unitils offers following features <ul><li>Mock object utilities </li></ul><ul><ul><li>Simplify EasyMock mock object creation </li></ul></ul><ul><ul><li>Simplify mock object injection </li></ul></ul><ul><ul><li>EasyMock argument matching using reflection equality </li></ul></ul><ul><li>Spring integration </li></ul><ul><ul><li>ApplicationContext configuration and easy injection of spring managed beans into a unit test </li></ul></ul><ul><ul><li>Support for using a Spring-configured Hibernate SessionFactory in unit tests. </li></ul></ul><ul><li>The project started begin 2006 from an Ordina J-Technologies discussion group on unit testing. The result was a list of guidelines and Unitils emerged in an attempt to write code to support these guidelines. </li></ul>
  6. 8. Open & extensible architecture <ul><li>Module system </li></ul><ul><ul><li>Listener hooks up modules into tests </li></ul></ul><ul><ul><li>Support for JUnit 3 / 4 + TestNG </li></ul></ul>
  7. 9. Module Systems <ul><li>Database Module </li></ul><ul><li>DBUnit module </li></ul><ul><ul><li>Test data management </li></ul></ul><ul><li>HibernateModule </li></ul><ul><li>Hibernate Configuration,Verify database mapping </li></ul><ul><li>SpringModule </li></ul><ul><ul><li>Load application Context, retrieve spring beans </li></ul></ul><ul><li>EasyMock Module:create mocks,lenient reflections arguments matching. </li></ul>
  8. 10. Database testing <ul><li>Control over test data </li></ul><ul><ul><li>Unit test database without data </li></ul></ul><ul><ul><li>Small test data sets </li></ul></ul><ul><li>Limited sharing of data sets </li></ul><ul><ul><li>Test class or method level </li></ul></ul>
  9. 11. Class-level data file
  10. 12. Method-level data file
  11. 13. Specify file name explicitly
  12. 14. Result data file
  13. 15. Hibernate support <ul><li>Simplify configuration </li></ul><ul><li>Automatically check consistency of </li></ul><ul><ul><li>mapped classes with database </li></ul></ul>
  14. 16. Assertion utils
  15. 17. Maintainability <ul><li>Only check what’s essential </li></ul><ul><ul><li>Ignore type of numbers </li></ul></ul><ul><ul><li>Ignore certain properties </li></ul></ul><ul><ul><li>Ignore order and type of collections </li></ul></ul>
  16. 18. Ignore order and type of Collections <ul><li>Leniency option: collections </li></ul>
  17. 19. Unitils Configuration <ul><li>As with many projects, Unitils needs some configuration of its services. By default, there are 3 levels of configuration, each level overriding the settings of the previous one </li></ul><ul><ul><li>unitils-defaults.properties : default configuration that is shipped with the distribution of Unitils </li></ul></ul><ul><ul><li>unitils.properties : can contain project-wide configuration </li></ul></ul><ul><ul><li>unitils-local.properties : can contain user-specific configuration </li></ul></ul>
  18. 21. Programme a tester <ul><li>Employees : DTO Object </li></ul><ul><li>IEmployeeDao : interface that declare CRUD opperations </li></ul><ul><li>EmployeeDaoImpl :a spring hibernate implementation </li></ul><ul><li>DataSource.xml :Spring Config DataSource </li></ul><ul><li>HibernateSessionFactory.xml: Spring Config of the hibernate SessionFactory </li></ul><ul><li>Dao.xml : DAO Beans </li></ul>
  19. 22. Programme de test <ul><li>HibernateMappingTest </li></ul><ul><li>EmployeeDaoTest : </li></ul><ul><li>EmployeeDao Testing Class </li></ul><ul><li>Unitils.properties : unitils config file </li></ul>
  20. 23. Configuration Unitils « unitils.properties »
  21. 24. HibernateMappingTest <ul><li>@SpringApplicationContext annotation instructs Unitils to create a Spring ApplicationContext, in which the DataSource.xml and HibernateSessionFactory.xml files are loaded </li></ul><ul><li>HibernateUnitils Unitils contains a very simple but powerful mapping test. This test checks whether the mapping of all Hibernate mapped objects is consistent with the database </li></ul>
  22. 25. HibernateMappingTest «   propety title of class Employees result goes titleD » <ul><li>junit.framework.AssertionFailedError: Found mismatches between Java objects and database tables. Applying following DDL statements to the database should resolve the problem: </li></ul><ul><li>alter table public.employees add column titleD varchar(0); </li></ul>
  23. 26. EmployeeDaoTest <ul><li>Creating an application context and retrieving a Spring bean </li></ul><ul><li>we tell the system to find a bean of type employeeDao in the application context </li></ul><ul><li>Loading a test data set </li></ul><ul><li>Checking the result </li></ul>
  24. 27. Links <ul><li>Unitils website: </li></ul><ul><li>http://unitils.sourceforge.net </li></ul><ul><li>Unit testing guidelines: </li></ul><ul><li>http://unitils.sourceforge.net/guidelines </li></ul>
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×